Skip to content

Commit 16f6d36

Browse files
Use map ordering for subscript identity
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
1 parent 24fc5a4 commit 16f6d36

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎rules/map/shim.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<K: Ord, T> Map<K, T> {
161161

162162
pub fn get_or_insert_with(&mut self, key: K, value: impl FnOnce() -> T) -> Value<T> {
163163
let prev = match self.nodes.range(..=&key).next_back() {
164-
Some((k, node)) if *k == key => {
164+
Some((k, node)) if k.cmp(&key) == std::cmp::Ordering::Equal => {
165165
return node
166166
.borrow()
167167
.value
@@ -376,7 +376,7 @@ impl<K: Ord, T> UnsafeMap<K, T> {
376376
let prev = match self.nodes.range(..=&key).next_back() {
377377
Some((k, node)) => {
378378
let node = &**node as *const UnsafeMapNode<T> as *mut UnsafeMapNode<T>;
379-
if *k == key {
379+
if k.cmp(&key) == std::cmp::Ordering::Equal {
380380
return UnsafeMapNode::value(node);
381381
}
382382
node

0 commit comments

Comments
 (0)