Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.9.0 with backports from master #231

Merged
merged 19 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hide unnecessary iterator visibility
(cherry picked from commit 9f2b14d)
  • Loading branch information
cuviper committed Jun 16, 2022
commit 971f8b92af0794b69d1089a5bed600073c92ef78
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ impl<K, V, S> IndexMap<K, V, S> {
/// [`keys`]: struct.IndexMap.html#method.keys
/// [`IndexMap`]: struct.IndexMap.html
pub struct Keys<'a, K, V> {
pub(crate) iter: SliceIter<'a, Bucket<K, V>>,
iter: SliceIter<'a, Bucket<K, V>>,
}

impl<'a, K, V> Iterator for Keys<'a, K, V> {
Expand Down Expand Up @@ -1137,7 +1137,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IterMut<'_, K, V> {
/// [`into_iter`]: struct.IndexMap.html#method.into_iter
/// [`IndexMap`]: struct.IndexMap.html
pub struct IntoIter<K, V> {
pub(crate) iter: vec::IntoIter<Bucket<K, V>>,
iter: vec::IntoIter<Bucket<K, V>>,
}

impl<K, V> Iterator for IntoIter<K, V> {
Expand Down
15 changes: 8 additions & 7 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<T, S> IndexSet<T, S> {
/// Return an iterator over the values of the set, in their order
pub fn iter(&self) -> Iter<'_, T> {
Iter {
iter: self.map.keys().iter,
iter: self.map.as_entries().iter(),
}
}

Expand Down Expand Up @@ -602,8 +602,10 @@ where
where
F: FnMut(&T, &T) -> Ordering,
{
let mut entries = self.into_entries();
entries.sort_by(move |a, b| cmp(&a.key, &b.key));
IntoIter {
iter: self.map.sorted_by(move |a, _, b, _| cmp(a, b)).iter,
iter: entries.into_iter(),
}
}

Expand Down Expand Up @@ -633,11 +635,10 @@ where
where
F: FnMut(&T, &T) -> Ordering,
{
let mut entries = self.into_entries();
entries.sort_unstable_by(move |a, b| cmp(&a.key, &b.key));
IntoIter {
iter: self
.map
.sorted_unstable_by(move |a, _, b, _| cmp(a, b))
.iter,
iter: entries.into_iter(),
}
}

Expand Down Expand Up @@ -877,7 +878,7 @@ impl<T, S> IntoIterator for IndexSet<T, S> {

fn into_iter(self) -> Self::IntoIter {
IntoIter {
iter: self.map.into_iter().iter,
iter: self.into_entries().into_iter(),
}
}
}
Expand Down