Skip to content

Commit 2e900df

Browse files
committed
cargo clippy --fix
1 parent cc8380f commit 2e900df

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Diff for: src/proptest_triemap.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn test_triemap_memory_reuse() {
110110

111111
// Remove some data
112112
for i in 0..50 {
113-
trie.remove(&format!("key_{}", i));
113+
trie.remove(format!("key_{}", i));
114114
}
115115

116116
// Check free indices after removal
@@ -127,7 +127,7 @@ fn test_triemap_memory_reuse() {
127127

128128
// Verify data integrity
129129
for i in 50..150 {
130-
assert_eq!(trie.get(&format!("key_{}", i)), Some(&(i as i32)));
130+
assert_eq!(trie.get(format!("key_{}", i)), Some(&{ i }));
131131
}
132132
}
133133

@@ -809,7 +809,7 @@ fn test_retained_capacity_after_removals() {
809809
let capacity_before = trie.capacity();
810810

811811
for i in 0..1000 {
812-
trie.remove(&format!("key_{}", i));
812+
trie.remove(format!("key_{}", i));
813813
}
814814

815815
let capacity_after = trie.capacity();
@@ -836,7 +836,7 @@ fn test_reused_indices_after_removal() {
836836
assert_eq!(trie.free_indices.len(), 0);
837837

838838
for i in 0..5 {
839-
trie.remove(&format!("key_{}", i));
839+
trie.remove(format!("key_{}", i));
840840
}
841841

842842
assert_eq!(trie.free_indices.len(), 5);
@@ -848,7 +848,7 @@ fn test_reused_indices_after_removal() {
848848
assert_eq!(trie.free_indices.len(), 0);
849849

850850
for i in 5..15 {
851-
assert_eq!(trie.get(&format!("key_{}", i)), Some(&i));
851+
assert_eq!(trie.get(format!("key_{}", i)), Some(&i));
852852
}
853853
}
854854

Diff for: src/trie_map.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ impl<T> TrieMap<T> {
719719
/// assert_eq!(map.get("a"), Some(&11));
720720
/// assert_eq!(map.get("b"), Some(&12));
721721
/// ```
722-
pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = (Vec<u8>, &'a mut T)> + 'a {
722+
pub fn iter_mut(&mut self) -> impl Iterator<Item = (Vec<u8>, &mut T)> + '_ {
723723
let mut keys_indices = Vec::with_capacity(self.size);
724724
let mut current_key = Vec::new();
725725
Self::collect_keys_indices(&self.root, &mut current_key, &mut keys_indices);
@@ -1640,7 +1640,6 @@ impl<T> TrieMap<T> {
16401640
) -> impl Iterator<Item = (Vec<u8>, &'a T)> + 'a {
16411641
self.iter()
16421642
.filter(move |(key, _)| other.contains_key(key))
1643-
.map(|(key, value)| (key, value))
16441643
}
16451644

16461645
/// Returns an iterator over the entries whose keys are in this map but not in the other map.
@@ -1670,7 +1669,6 @@ impl<T> TrieMap<T> {
16701669
) -> impl Iterator<Item = (Vec<u8>, &'a T)> + 'a {
16711670
self.iter()
16721671
.filter(move |(key, _)| !other.contains_key(key))
1673-
.map(|(key, value)| (key, value))
16741672
}
16751673

16761674
/// Returns an iterator over entries whose keys are in exactly one of the maps.

Diff for: src/trie_map/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ fn test_entry_or_insert_with() {
12141214
100
12151215
});
12161216
assert_eq!(*value, 84);
1217-
assert_eq!(called.get(), false);
1217+
assert!(!called.get());
12181218
}
12191219
}
12201220

@@ -1792,7 +1792,7 @@ fn test_get_or_insert_with() {
17921792
});
17931793

17941794
assert_eq!(*value, 42);
1795-
assert_eq!(called.get(), false);
1795+
assert!(!called.get());
17961796
}
17971797
}
17981798

0 commit comments

Comments
 (0)