From c7da2199f88a2903e3e1d4e35d0a0f3875f8e846 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 4 Mar 2021 17:16:24 -0800 Subject: [PATCH 1/3] Continue #167 with more "postion" typos --- src/map/core.rs | 2 +- src/map/core/raw.rs | 2 +- src/set.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/map/core.rs b/src/map/core.rs index aaa3768a..c4e725c9 100644 --- a/src/map/core.rs +++ b/src/map/core.rs @@ -563,7 +563,7 @@ impl OccupiedEntry<'_, K, V> { /// /// Like `Vec::swap_remove`, the pair is removed by swapping it with the /// last element of the map and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Computes in **O(1)** time (average). pub fn swap_remove(self) -> V { diff --git a/src/map/core/raw.rs b/src/map/core/raw.rs index 0115b07f..168e1af3 100644 --- a/src/map/core/raw.rs +++ b/src/map/core/raw.rs @@ -152,7 +152,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// Like `Vec::swap_remove`, the pair is removed by swapping it with the /// last element of the map and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Computes in **O(1)** time (average). pub fn swap_remove_entry(self) -> (K, V) { diff --git a/src/set.rs b/src/set.rs index 29fb64f0..aa4e7749 100644 --- a/src/set.rs +++ b/src/set.rs @@ -425,7 +425,7 @@ where /// /// Like `Vec::swap_remove`, the value is removed by swapping it with the /// last element of the set and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Return `false` if `value` was not in the set. /// @@ -473,7 +473,7 @@ where /// /// Like `Vec::swap_remove`, the value is removed by swapping it with the /// last element of the set and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Return `None` if `value` was not in the set. /// @@ -506,7 +506,7 @@ where /// /// Like `Vec::swap_remove`, the value is removed by swapping it with the /// last element of the set and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Return `None` if `value` was not in the set. pub fn swap_remove_full(&mut self, value: &Q) -> Option<(usize, T)> @@ -622,7 +622,7 @@ impl IndexSet { /// /// Like `Vec::swap_remove`, the value is removed by swapping it with the /// last element of the set and popping it off. **This perturbs - /// the postion of what used to be the last element!** + /// the position of what used to be the last element!** /// /// Computes in **O(1)** time (average). pub fn swap_remove_index(&mut self, index: usize) -> Option { From 0dc0c7b73de03a56f68f4de1f5d8896985572454 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 4 Mar 2021 17:30:41 -0800 Subject: [PATCH 2/3] cargo fmt --- src/map.rs | 2 +- test-nostd/src/lib.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/map.rs b/src/map.rs index e16e064a..3bfaa150 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1665,7 +1665,7 @@ mod tests { let ptr = *e.key() as *const i32; assert_eq!(ptr, k1_ptr); assert_ne!(ptr, k2_ptr); - }, + } Entry::Vacant(_) => panic!(), } } diff --git a/test-nostd/src/lib.rs b/test-nostd/src/lib.rs index d54ade9d..0b57b092 100644 --- a/test-nostd/src/lib.rs +++ b/test-nostd/src/lib.rs @@ -11,7 +11,9 @@ use indexmap::IndexSet; struct BadHasher(u64); impl Hasher for BadHasher { - fn finish(&self) -> u64 { self.0 } + fn finish(&self) -> u64 { + self.0 + } fn write(&mut self, bytes: &[u8]) { for &byte in bytes { self.0 += byte as u64 From 6b54fded902f9d0d10a8a15ff3addf09eccd9380 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 4 Mar 2021 17:30:59 -0800 Subject: [PATCH 3/3] Release 1.6.2 --- Cargo.toml | 2 +- README.rst | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b9bf5498..d79a52e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "indexmap" edition = "2018" -version = "1.6.1" +version = "1.6.2" authors = [ "bluss", "Josh Stone " diff --git a/README.rst b/README.rst index 49a71073..1cf5368b 100644 --- a/README.rst +++ b/README.rst @@ -66,6 +66,17 @@ which is roughly: Recent Changes ============== +- 1.6.2 + + - Fixed to match ``std`` behavior, ``OccupiedEntry::key`` now references the + existing key in the map instead of the lookup key, by @cuviper in PR 170_. + + - The new ``Entry::or_insert_with_key`` matches Rust 1.50's ``Entry`` method, + passing ``&K`` to the callback to create a value, by @cuviper in PR 175_. + +.. _170: https://github.com/bluss/indexmap/pull/170 +.. _175: https://github.com/bluss/indexmap/pull/175 + - 1.6.1 - The new ``serde_seq`` module implements ``IndexMap`` serialization as a