Skip to content

Commit

Permalink
fix: false positive identity map warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Rosenkranz-Costa committed Jan 10, 2024
1 parent 0ebc698 commit 9bcc427
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/data_struct/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pros:

- same serialized size

- accessing elements is the almost as fast as an `HashMap` with one additional memory access
- accessing elements is almost as fast as an `HashMap` with one additional memory access

- updating the key of an element (e.g. renaming an attribute) can be performed in constant time without modifying the order

Expand Down Expand Up @@ -68,6 +68,8 @@ Cons:

- no direct access to a given coordinate's keys (would be a nice to have but not really needed in practice)

- multiple insertions with the same coordinate will result in multiple entries in the vector thus corrupting the structure

- following linked list pointers can be slower than iterating a regular vector

- serialization requires following each linked list
Expand Down
1 change: 1 addition & 0 deletions src/data_struct/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ where
}

/// Returns an iterator over keys and values in insertion order.
#[allow(clippy::map_identity)] // unpack &(x, y) to (&x, &y)
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)> {
self.entries.iter().map(|(k, v)| (k, v))
}
Expand Down
2 changes: 2 additions & 0 deletions src/data_struct/revision_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ impl<K, T> RevisionVec<K, T> {
}

/// Returns an iterator over each key-chains pair
#[allow(clippy::map_identity)] // unpack &(x, y) to (&x, &y)
pub fn iter(&self) -> impl Iterator<Item = (&K, &RevisionList<T>)> {
self.chains.iter().map(|(key, chain)| (key, chain))
}

/// Returns an iterator over each key-chains pair that allow modifying chain
#[allow(clippy::map_identity)] // unpack &mut (x, y) to (&x, &mut y)
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut RevisionList<T>)>
where
K: Clone,
Expand Down

0 comments on commit 9bcc427

Please sign in to comment.