Skip to content

Commit c1bb5cc

Browse files
committed
fix some match
1 parent de16454 commit c1bb5cc

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

crates/code_analysis/src/semantic/instantiate/tpl_pattern.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ fn union_tpl_pattern_match(
169169
Some(())
170170
}
171171

172-
#[allow(unused)]
173172
fn func_tpl_pattern_match(
174173
db: &DbIndex,
175174
config: &mut LuaInferConfig,
@@ -183,11 +182,19 @@ fn func_tpl_pattern_match(
183182
let params = doc_func.get_params();
184183
let target_params = target_doc_func.get_params();
185184
for (i, param_tuple) in params.iter().enumerate() {
186-
let target_param_tuple = target_params.get(i)?;
187-
if param_tuple.1.is_some() && target_param_tuple.1.is_some() {
188-
let param_type = param_tuple.1.clone()?;
189-
let target_param_type = target_param_tuple.1.clone()?;
190-
tpl_pattern_match(db, config, root, &param_type, &target_param_type, result);
185+
if let Some(target_param_tuple) = target_params.get(i) {
186+
if param_tuple.1.is_some() && target_param_tuple.1.is_some() {
187+
let param_type = param_tuple.1.clone()?;
188+
let target_param_type = target_param_tuple.1.clone()?;
189+
tpl_pattern_match(
190+
db,
191+
config,
192+
root,
193+
&param_type,
194+
&target_param_type,
195+
result,
196+
);
197+
}
191198
}
192199
}
193200

@@ -214,7 +221,14 @@ fn func_tpl_pattern_match(
214221
let rets = doc_func.get_ret();
215222
for (i, ret_type) in rets.iter().enumerate() {
216223
if let Some(signature_ret_info) = &signature.return_docs.get(i) {
217-
tpl_pattern_match(db, config, root, ret_type, &signature_ret_info.type_ref, result);
224+
tpl_pattern_match(
225+
db,
226+
config,
227+
root,
228+
ret_type,
229+
&signature_ret_info.type_ref,
230+
result,
231+
);
218232
}
219233
}
220234
}

0 commit comments

Comments
 (0)