From d8d35dbfcc4580ce1859a6f9489e2cce85575620 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov <mail4score@gmail.com> Date: Tue, 10 Dec 2024 01:04:02 +0200 Subject: [PATCH] Clippy fixes --- crates/rust-analyzer/src/handlers/request.rs | 2 +- crates/rust-analyzer/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index 851341dfdf..3f2ef7616b 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -1138,7 +1138,7 @@ pub(crate) fn handle_completion_resolve( }; let Some(corresponding_completion) = completions.into_iter().find(|completion_item| { - let hash = completion_item_hash(&completion_item, resolve_data.for_ref); + let hash = completion_item_hash(completion_item, resolve_data.for_ref); hash == resolve_data.hash }) else { return Ok(original_completion); diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index aed8479589..8c8ac8de81 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs @@ -71,7 +71,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; CompletionRelevanceTypeMatch, }; - hasher.update(&[ + hasher.update([ u8::from(relevance.exact_name_match), u8::from(relevance.is_local), u8::from(relevance.is_name_already_imported), @@ -86,7 +86,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; hasher.update(label); } if let Some(trait_) = &relevance.trait_ { - hasher.update(&[u8::from(trait_.is_op_method), u8::from(trait_.notable_trait)]); + hasher.update([u8::from(trait_.is_op_method), u8::from(trait_.notable_trait)]); } if let Some(postfix_match) = &relevance.postfix_match { let label = match postfix_match { @@ -96,7 +96,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; hasher.update(label); } if let Some(function) = &relevance.function { - hasher.update(&[u8::from(function.has_params), u8::from(function.has_self_param)]); + hasher.update([u8::from(function.has_params), u8::from(function.has_self_param)]); let label = match function.return_type { CompletionRelevanceReturnType::Other => "other", CompletionRelevanceReturnType::DirectConstructor => "direct_constructor", @@ -108,7 +108,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; } let mut hasher = TentHasher::new(); - hasher.update(&[ + hasher.update([ u8::from(is_ref_completion), u8::from(item.is_snippet), u8::from(item.deprecated),