From e506e1816d6f67593edc8e531661635492a7226e Mon Sep 17 00:00:00 2001 From: Thomas Korrison Date: Mon, 27 Apr 2026 13:55:19 +0100 Subject: [PATCH 1/2] Apply suggested fix to src/store/weight.rs from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- src/store/weight.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/store/weight.rs b/src/store/weight.rs index cc94e73..6d7b86e 100644 --- a/src/store/weight.rs +++ b/src/store/weight.rs @@ -1159,8 +1159,9 @@ where /// Removes all entries and resets total weight. /// /// Acquires write lock. Attributes the cleared entries to the outer - /// `removes` metric. Inner-store counters are ignored here so the - /// public metrics surface counts each bulk clear exactly once. + /// `removes` metric. Inner-store metrics counters are not consulted + /// here; removal count is derived from `store.map.len()` so the public + /// metrics surface counts each bulk clear exactly once. fn clear(&self) { let mut store = self.inner.write(); let removed = store.map.len() as u64; From d310faf116aa08adef34479e90327a48f3103359 Mon Sep 17 00:00:00 2001 From: Thomas Korrison Date: Mon, 27 Apr 2026 13:55:19 +0100 Subject: [PATCH 2/2] Apply suggested fix to src/store/weight.rs from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- src/store/weight.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/weight.rs b/src/store/weight.rs index 6d7b86e..089789c 100644 --- a/src/store/weight.rs +++ b/src/store/weight.rs @@ -811,8 +811,7 @@ where /// /// `total_weight` is reset *before* dropping the map contents so that /// under `panic = "unwind"` a panicking `V::Drop` still leaves the - /// store in a self-consistent state (`map.len() == 0`, the hashbrown - /// `ClearOnDrop` guard guarantees this; `total_weight == 0`). + /// store in a self-consistent state (`map.len() == 0`; `total_weight == 0`). /// Remaining values may leak via the unwinding drop, but no stale /// weight baseline can inflate future capacity checks. ///