Closed
Description
This looks like a bug to me. I'd expect this test-case to pass:
#[test]
fn eq() {
let m1: IndexMap<_, _> = vec![(1, 1), (2, 2)].into_iter().collect();
let m2: IndexMap<_, _> = vec![(2, 2), (1, 1)].into_iter().collect();
assert_ne!(m1, m2);
}
The maps are most definitely not the same, and if you're using IndexMap
is because you care about ordering.
This came up because I was doing some Firefox profiling, and transitioning youtube from fullscreen to not-fullscreen or vice versa spends a lot of time under find()
comparing custom properties (doing the lookup in IndexMap::eq
). Turns out we don't actually need to do any lookup, and not being ordering aware is a correctness issue.
Metadata
Metadata
Assignees
Labels
No labels