Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/item.rs')
| -rw-r--r-- | crates/ide-completion/src/item.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs index e6dd1d37d9..62211a808c 100644 --- a/crates/ide-completion/src/item.rs +++ b/crates/ide-completion/src/item.rs @@ -184,6 +184,8 @@ pub struct CompletionRelevance { pub function: Option<CompletionRelevanceFn>, /// true when there is an `await.method()` or `iter().method()` completion. pub is_skipping_completion: bool, + /// if inherent impl already exists in current module, user may not want to implement it again. + pub has_local_inherent_impl: bool, } #[derive(Debug, Clone, Copy, Eq, PartialEq)] pub struct CompletionRelevanceTraitInfo { @@ -275,6 +277,7 @@ impl CompletionRelevance { trait_, function, is_skipping_completion, + has_local_inherent_impl, } = self; // only applicable for completions within use items @@ -347,6 +350,10 @@ impl CompletionRelevance { score += fn_score; }; + if has_local_inherent_impl { + score -= 5; + } + score } |