-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI test cleanup: Extract derive_hash_xor_eq tests
- Loading branch information
Showing
4 changed files
with
95 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::hash::{Hash, Hasher}; | ||
|
||
#[derive(PartialEq, Hash)] | ||
struct Foo; | ||
|
||
impl PartialEq<u64> for Foo { | ||
fn eq(&self, _: &u64) -> bool { | ||
true | ||
} | ||
} | ||
|
||
#[derive(Hash)] | ||
struct Bar; | ||
|
||
impl PartialEq for Bar { | ||
fn eq(&self, _: &Bar) -> bool { | ||
true | ||
} | ||
} | ||
|
||
#[derive(Hash)] | ||
struct Baz; | ||
|
||
impl PartialEq<Baz> for Baz { | ||
fn eq(&self, _: &Baz) -> bool { | ||
true | ||
} | ||
} | ||
|
||
#[derive(PartialEq)] | ||
struct Bah; | ||
|
||
impl Hash for Bah { | ||
fn hash<H: Hasher>(&self, _: &mut H) {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly | ||
--> $DIR/derive_hash_xor_eq.rs:12:10 | ||
| | ||
LL | #[derive(Hash)] | ||
| ^^^^ | ||
| | ||
= note: `#[deny(clippy::derive_hash_xor_eq)]` on by default | ||
note: `PartialEq` implemented here | ||
--> $DIR/derive_hash_xor_eq.rs:15:1 | ||
| | ||
LL | / impl PartialEq for Bar { | ||
LL | | fn eq(&self, _: &Bar) -> bool { | ||
LL | | true | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
|
||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly | ||
--> $DIR/derive_hash_xor_eq.rs:21:10 | ||
| | ||
LL | #[derive(Hash)] | ||
| ^^^^ | ||
| | ||
note: `PartialEq` implemented here | ||
--> $DIR/derive_hash_xor_eq.rs:24:1 | ||
| | ||
LL | / impl PartialEq<Baz> for Baz { | ||
LL | | fn eq(&self, _: &Baz) -> bool { | ||
LL | | true | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
|
||
error: you are implementing `Hash` explicitly but have derived `PartialEq` | ||
--> $DIR/derive_hash_xor_eq.rs:33:1 | ||
| | ||
LL | / impl Hash for Bah { | ||
LL | | fn hash<H: Hasher>(&self, _: &mut H) {} | ||
LL | | } | ||
| |_^ | ||
| | ||
note: `PartialEq` implemented here | ||
--> $DIR/derive_hash_xor_eq.rs:30:10 | ||
| | ||
LL | #[derive(PartialEq)] | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|