rust/clippy_lints
Quinn Sinclair 3c1e0afa58 New Lint [impl_hash_with_borrow_str_and_bytes]
Implements a lint to prevent implementation of Hash, Borrow<str> and
Borrow<[u8]> as it breaks Borrow<T> "semantics". According to the book,
types that implement Borrow<A> and Borrow<B> must ensure equality of
borrow results under Eq,Ord and Hash.

> In particular Eq, Ord and Hash must be equivalent for borrowed and
owned values: x.borrow() == y.borrow() should give the same result as x == y.

In the same way, hash(x) == hash(x as Borrow<[u8]>) != hash(x as Borrow<str>).

changelog: newlint [`impl_hash_with_borrow_str_and_bytes`]
2023-11-19 11:33:01 +01:00
..
src New Lint [impl_hash_with_borrow_str_and_bytes] 2023-11-19 11:33:01 +01:00
Cargo.toml Bump Clippy version -> 0.1.76 2023-11-16 19:02:33 +01:00
README.md

This crate contains Clippy lints. For the main crate, check GitHub.