rust-nodemap: implement `PartialEq` without allocation
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 09 Jan 2023 18:58:18 +0100
changeset 49927 2202832b35e8
parent 49926 0780371d6b1e
child 49928 ccb6cfb0f2c0
rust-nodemap: implement `PartialEq` without allocation This was caught by `clippy`. It's probable that this ends up optimized out by the compiler, but let's not rely on that.
rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs	Mon Jan 09 18:54:57 2023 +0100
+++ b/rust/hg-core/src/revlog/node.rs	Mon Jan 09 18:58:18 2023 +0100
@@ -314,7 +314,7 @@
 
 impl PartialEq<Node> for NodePrefix {
     fn eq(&self, other: &Node) -> bool {
-        Self::from(*other) == *self
+        self.data == other.data && self.nybbles_len() == other.nybbles_len()
     }
 }