about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHongxu Xu <xuhongxu96@hotmail.com>2022-07-07 00:54:46 +0800
committerHongxu Xu <xuhongxu96@hotmail.com>2022-07-07 00:54:46 +0800
commit0360ed53cf7f5b146068f3e8f4a12094e93b4685 (patch)
tree6eaeaea38a8c5696b454272ef1f4d72fa37ed7e9
parent75fb3de310d1777c53604a818308e7fce1925e7e (diff)
downloadrust-0360ed53cf7f5b146068f3e8f4a12094e93b4685.tar.gz
rust-0360ed53cf7f5b146068f3e8f4a12094e93b4685.zip
check arg_idx >= n_params only if arg_idx >= n_required_params
-rw-r--r--crates/ide-completion/src/completions/type.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide-completion/src/completions/type.rs b/crates/ide-completion/src/completions/type.rs
index b2d5b6f5bde..0469d349519 100644
--- a/crates/ide-completion/src/completions/type.rs
+++ b/crates/ide-completion/src/completions/type.rs
@@ -181,12 +181,12 @@ pub(crate) fn complete_type_path(
                                                     acc.add_type_alias_with_eq(ctx, alias);
                                                 }
                                             });
-                                    }
 
-                                    let n_params =
-                                        trait_.type_or_const_param_count(ctx.sema.db, false);
-                                    if arg_idx >= n_params {
-                                        return; // only show assoc types
+                                        let n_params =
+                                            trait_.type_or_const_param_count(ctx.sema.db, false);
+                                        if arg_idx >= n_params {
+                                            return; // only show assoc types
+                                        }
                                     }
                                 }
                             }