Skip to content

Commit

Permalink
clippy::iter_without_into_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
grim7reaper committed Jan 15, 2024
1 parent 713a571 commit d8e5cb8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Possible sections are:
<!-- next-header -->
## [Unreleased] - ReleaseDate

### Added

- `IntoIterator` implementation for `FrozenMap` and `FrozenSet`

## [0.1.1] - 2024-01-15

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "h3o-ice"
version = "0.1.1"
version = "0.1.2"
authors = ["Sylvain Laperche <[email protected]>"]
edition = "2021"
description = "Frozen{Map,Set} for H3 cells, based on finite state transducers."
Expand Down
9 changes: 9 additions & 0 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,15 @@ impl FrozenMap<Vec<u8>> {
}
}

impl<'a, D: AsRef<[u8]>> IntoIterator for &'a FrozenMap<D> {
type Item = (CellIndex, u64);
type IntoIter = FrozenMapIterator<'a>;

fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}

// ------------------------------------------------------------------------------

/// A builder for creating a frozen map.
Expand Down
9 changes: 9 additions & 0 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ impl FrozenSet<Vec<u8>> {
}
}

impl<'a, D: AsRef<[u8]>> IntoIterator for &'a FrozenSet<D> {
type Item = CellIndex;
type IntoIter = FrozenSetIterator<'a>;

fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}

// ------------------------------------------------------------------------------

/// A builder for creating a frozen set.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn load_from_bytes() {

// Data is exactly the same.
assert_eq!(
expected.iter().collect::<Vec<_>>(),
expected.into_iter().collect::<Vec<_>>(),
result.iter().collect::<Vec<_>>()
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn load_from_bytes() {

// Data is exactly the same.
assert_eq!(
expected.iter().collect::<Vec<_>>(),
expected.into_iter().collect::<Vec<_>>(),
result.iter().collect::<Vec<_>>()
);
}
Expand Down

0 comments on commit d8e5cb8

Please sign in to comment.