mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
ae0f0fd655
`Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ^^^^^^^^^^^^^^^^ ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar.
77 lines
2.1 KiB
Text
77 lines
2.1 KiB
Text
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:21:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: existing `foo` defined here
|
|
--> $DIR/same_name_method.rs:26:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
= note: `-D clippy::same-name-method` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::same_name_method)]`
|
|
|
|
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:36:13
|
|
|
|
|
LL | fn clone() {}
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: existing `clone` defined here
|
|
--> $DIR/same_name_method.rs:32:18
|
|
|
|
|
LL | #[derive(Clone)]
|
|
| ^^^^^
|
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:47:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: existing `foo` defined here
|
|
--> $DIR/same_name_method.rs:52:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:62:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: existing `foo` defined here
|
|
--> $DIR/same_name_method.rs:66:9
|
|
|
|
|
LL | impl T1 for S {}
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:75:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: existing `foo` defined here
|
|
--> $DIR/same_name_method.rs:80:9
|
|
|
|
|
LL | impl T1 for S {}
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: method's name is the same as an existing method in a trait
|
|
--> $DIR/same_name_method.rs:75:13
|
|
|
|
|
LL | fn foo() {}
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: existing `foo` defined here
|
|
--> $DIR/same_name_method.rs:82:9
|
|
|
|
|
LL | impl T2 for S {}
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 6 previous errors
|
|
|