Skip to content

Commit 025230a

Browse files
Potential fixes for 2 code quality findings (#115)
* 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> * 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> --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 280d4f9 commit 025230a

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

src/store/weight.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,6 @@ where
733733
pub fn try_insert(&mut self, key: K, value: Arc<V>) -> Result<Option<Arc<V>>, StoreFull> {
734734
let new_weight = self.compute_weight(value.as_ref());
735735
if let Some(entry) = self.map.get_mut(&key) {
736-
assert!(
737-
self.total_weight >= entry.weight,
738-
"WeightStore invariant violated: total_weight ({}) is less than entry.weight ({})",
739-
self.total_weight,
740-
entry.weight
741-
);
742736
let base_total = self
743737
.total_weight
744738
.checked_sub(entry.weight)
@@ -802,10 +796,6 @@ where
802796
/// ```
803797
pub fn remove(&mut self, key: &K) -> Option<Arc<V>> {
804798
let entry = self.map.remove(key)?;
805-
assert!(
806-
self.total_weight >= entry.weight,
807-
"total_weight underflow in remove"
808-
);
809799
self.total_weight = self
810800
.total_weight
811801
.checked_sub(entry.weight)

0 commit comments

Comments
 (0)