From 244bd814c20cc5c69549d3cf139ae7d5364e4e87 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sun, 28 Jan 2024 16:28:54 -0800 Subject: [PATCH] Fix `RawOccupiedEntryMut::into_key` --- Cargo.toml | 2 +- RELEASES.md | 6 ++++++ src/map/core/raw_entry_v1.rs | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bf4fe206..1bbf4940 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "indexmap" edition = "2021" -version = "2.2.0" +version = "2.2.1" documentation = "https://docs.rs/indexmap/" repository = "https://github.com/indexmap-rs/indexmap" license = "Apache-2.0 OR MIT" diff --git a/RELEASES.md b/RELEASES.md index 92811bfc..50551186 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,9 @@ +- 2.2.1 + + - Corrected the signature of `RawOccupiedEntryMut::into_key(self) -> &'a mut K`, + This a breaking change from 2.2.0, but that version was published for less + than a day and has now been yanked. + - 2.2.0 - The new `IndexMap::get_index_entry` method finds an entry by its index for diff --git a/src/map/core/raw_entry_v1.rs b/src/map/core/raw_entry_v1.rs index bdc19d87..ad27cf03 100644 --- a/src/map/core/raw_entry_v1.rs +++ b/src/map/core/raw_entry_v1.rs @@ -384,8 +384,8 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> { /// Note that this is not the key that was used to find the entry. There may be an observable /// difference if the key type has any distinguishing features outside of `Hash` and `Eq`, like /// extra fields or the memory address of an allocation. - pub fn into_key(&mut self) -> &mut K { - &mut self.raw.bucket_mut().key + pub fn into_key(self) -> &'a mut K { + &mut self.raw.into_bucket().key } /// Gets a reference to the entry's value in the map.