Skip to content

Commit d77bed4

Browse files
authored
chore: avoid redundant clone in unordered_hash_map sorting (#8714)
1 parent 865bb5e commit d77bed4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/cairo-lang-utils/src/unordered_hash_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ impl<Key: Eq + Hash, Value, BH: BuildHasher> UnorderedHashMap<Key, Value, BH> {
259259
/// A consuming version of `iter_sorted`.
260260
pub fn into_iter_sorted(self) -> impl Iterator<Item = (Key, Value)>
261261
where
262-
Key: Ord + Clone,
262+
Key: Ord,
263263
{
264-
self.0.into_iter().sorted_by_key(|(key, _)| key.clone())
264+
self.0.into_iter().sorted_by(|(lhs, _), (rhs, _)| lhs.cmp(rhs))
265265
}
266266

267267
/// Iterates the map in an ascending order of the keys produced by the given function `f`.

0 commit comments

Comments
 (0)