From 92b72b133450036ab6a93b9a887de8fae53c848a Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 31 Oct 2023 02:22:49 +0100 Subject: [PATCH] indexmap: add another previously-failing assert. --- CHANGELOG.md | 1 + src/indexmap.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76553c6f..b2dfeedd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed a `dropping_references` warning in `LinearMap`. +- Fixed IndexMap entry API returning wrong slot after an insert on vacant entry. (#360) ### Removed diff --git a/src/indexmap.rs b/src/indexmap.rs index 3dee9671..8e14ce9c 100644 --- a/src/indexmap.rs +++ b/src/indexmap.rs @@ -1469,7 +1469,7 @@ mod tests { panic!("Entry found before insert"); } Entry::Vacant(v) => { - v.insert(i).unwrap(); + assert_eq!(i, *v.insert(i).unwrap()); } } }