Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/Cargo.toml14
-rw-r--r--crates/rust-analyzer/src/lib.rs17
2 files changed, 16 insertions, 15 deletions
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 022b0a0ecf..58d871270d 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -92,13 +92,13 @@ jemalloc = ["jemallocator", "profile/jemalloc"]
force-always-assert = ["always-assert/force"]
sysroot-abi = []
in-rust-tree = [
- "sysroot-abi",
- "syntax/in-rust-tree",
- "parser/in-rust-tree",
- "hir/in-rust-tree",
- "hir-def/in-rust-tree",
- "hir-ty/in-rust-tree",
- "load-cargo/in-rust-tree",
+ "sysroot-abi",
+ "syntax/in-rust-tree",
+ "parser/in-rust-tree",
+ "hir/in-rust-tree",
+ "hir-def/in-rust-tree",
+ "hir-ty/in-rust-tree",
+ "load-cargo/in-rust-tree",
]
[lints]
diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs
index 8f74e75d3d..7cf88e60db 100644
--- a/crates/rust-analyzer/src/lib.rs
+++ b/crates/rust-analyzer/src/lib.rs
@@ -77,12 +77,19 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8;
}
}
- fn has_completion_relevance(hasher: &mut TentHasher, relevance: &CompletionRelevance) {
+ fn hash_completion_relevance(hasher: &mut TentHasher, relevance: &CompletionRelevance) {
use ide_completion::{
CompletionRelevancePostfixMatch, CompletionRelevanceReturnType,
CompletionRelevanceTypeMatch,
};
+ hasher.update(&[
+ u8::from(relevance.exact_name_match),
+ u8::from(relevance.is_local),
+ u8::from(relevance.is_name_already_imported),
+ u8::from(relevance.requires_import),
+ u8::from(relevance.is_private_editable),
+ ]);
if let Some(type_match) = &relevance.type_match {
let label = match type_match {
CompletionRelevanceTypeMatch::CouldUnify => "could_unify",
@@ -90,15 +97,9 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8;
};
hasher.update(label);
}
- hasher.update(&[u8::from(relevance.exact_name_match), u8::from(relevance.is_local)]);
if let Some(trait_) = &relevance.trait_ {
hasher.update(&[u8::from(trait_.is_op_method), u8::from(trait_.notable_trait)]);
}
- hasher.update(&[
- u8::from(relevance.is_name_already_imported),
- u8::from(relevance.requires_import),
- u8::from(relevance.is_private_editable),
- ]);
if let Some(postfix_match) = &relevance.postfix_match {
let label = match postfix_match {
CompletionRelevancePostfixMatch::NonExact => "non_exact",
@@ -139,7 +140,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8;
if let Some(documentation) = &item.documentation {
hasher.update(documentation.as_str());
}
- has_completion_relevance(&mut hasher, &item.relevance);
+ hash_completion_relevance(&mut hasher, &item.relevance);
if let Some((mutability, text_size)) = &item.ref_match {
hasher.update(mutability.as_keyword_for_ref());
hasher.update(u32::from(*text_size).to_le_bytes());