Skip to content

Commit c208bac

Browse files
committed
book-store: explicitly implement PartialEq
clippy: error: you are implementing `Hash` explicitly but have derived `PartialEq` note: `#[deny(clippy::derive_hash_xor_eq)]` on by default help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
1 parent ea988ad commit c208bac

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

exercises/book-store/example.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type GroupedBasket = Vec<Group>;
1010
type Price = u32;
1111
const BOOK_PRICE: Price = 800;
1212

13-
#[derive(Debug, Clone, PartialEq, Eq)]
13+
#[derive(Debug, Clone)]
1414
struct Group(RefCell<BTreeSet<Book>>);
1515

1616
impl Group {
@@ -65,6 +65,14 @@ impl PartialOrd for Group {
6565
}
6666
}
6767

68+
impl PartialEq for Group {
69+
fn eq(&self, other: &Group) -> bool {
70+
self.0.borrow().eq(&other.0.borrow())
71+
}
72+
}
73+
74+
impl Eq for Group {}
75+
6876
impl Hash for Group {
6977
fn hash<H: Hasher>(&self, hasher: &mut H) {
7078
self.0.borrow().hash(hasher);

0 commit comments

Comments
 (0)