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()); } } }