File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 103103
104104#![ cfg_attr( test, deny( warnings) ) ]
105105
106+ // Types, such as Atom, that impl Hash must follow the hash invariant: if two objects match
107+ // with PartialEq, they must also have the same Hash. Clippy warns on types that derive one while
108+ // manually impl-ing the other, because it seems easy for the two to drift apart, causing the
109+ // invariant to be violated.
110+ //
111+ // But Atom is a newtype over NonZeroU64, and probably always will be, since cheap comparisons and
112+ // copying are this library's purpose. So we know what the PartialEq comparison is going to do.
113+ //
114+ // The `get_hash` function, seen in `atom.rs`, consults that number, plus the global string interner
115+ // tables. The only way for the resulting hash for two Atoms with the same inner 64-bit number to
116+ // differ would be if the table entry changed between invocations, and that would be really bad.
117+ #![ allow( clippy:: derive_hash_xor_eq) ]
118+
106119mod atom;
107120mod dynamic_set;
108121mod static_sets;
You can’t perform that action at this time.
0 commit comments