From d6943d976ddf0fd2aab634f3634714f4007cb378 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Wed, 29 Jan 2025 12:07:20 +0100 Subject: [PATCH] Update TentHash to version 1.0 The TentHash spec was frozen Jan 1st 2025, and release 1.0 of the Rust crate is a minor cleanup as a follow-up to that, representing a commitment to API stability as well. The hash output remains the same as version 0.4, which rust-analyzer was previously using. The only API change was a struct rename. --- Cargo.lock | 4 ++-- crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/lib.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2dfca7c480..3ba7df3ad5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2001,9 +2001,9 @@ dependencies = [ [[package]] name = "tenthash" -version = "0.4.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d67f9f3cf70e0852941d7bc3cb884b49b24b8ee956baf91ad0abae31f5ef11fb" +checksum = "2d092d622df8bb64e5de8dc86a3667702d5f1e0fe2f0604c6035540703c8cd1e" [[package]] name = "test-fixture" diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index c24cbb4a31..b8ce2b7430 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -37,7 +37,7 @@ rustc-hash.workspace = true serde_json = { workspace = true, features = ["preserve_order"] } serde.workspace = true serde_derive.workspace = true -tenthash = "0.4.0" +tenthash = "1.0.0" num_cpus = "1.15.0" mimalloc = { version = "0.1.30", default-features = false, optional = true } lsp-server.workspace = true diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index ccffa7a671..02361a2232 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs @@ -50,7 +50,7 @@ mod integrated_benchmarks; use hir::Mutability; use ide::{CompletionItem, CompletionItemRefMode, CompletionRelevance}; use serde::de::DeserializeOwned; -use tenthash::TentHasher; +use tenthash::TentHash; pub use crate::{ lsp::capabilities::server_capabilities, main_loop::main_loop, reload::ws_to_crate_graph, @@ -66,7 +66,7 @@ pub fn from_json( } fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; 20] { - fn hash_completion_relevance(hasher: &mut TentHasher, relevance: &CompletionRelevance) { + fn hash_completion_relevance(hasher: &mut TentHash, relevance: &CompletionRelevance) { use ide_completion::{ CompletionRelevancePostfixMatch, CompletionRelevanceReturnType, CompletionRelevanceTypeMatch, @@ -108,7 +108,7 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8; } } - let mut hasher = TentHasher::new(); + let mut hasher = TentHash::new(); hasher.update([ u8::from(is_ref_completion), u8::from(item.is_snippet),