about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNadrieril <Nadrieril@users.noreply.github.com>2024-01-31 12:10:52 +0100
committerGitHub <noreply@github.com>2024-01-31 12:10:52 +0100
commitbe4f8e2758174cf27643a4eb5e3c7adee338223d (patch)
tree09e64a01c4e34cfe032b9be22e5e892f862a7af4 /src
parent032596e34cd46e3bee3081b0aa9c0e2d7e72ba5a (diff)
parent4225a1e186afe39c1ae81c5065d24287d6d49fb9 (diff)
Rollup merge of #120490 - nnethercote:Diagnostic-hashing, r=estebank
Don't hash lints differently to non-lints.

`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.

r? `@estebank`
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/tests/ui/same_name_method.rs1
-rw-r--r--src/tools/clippy/tests/ui/same_name_method.stderr16
2 files changed, 15 insertions, 2 deletions
diff --git a/src/tools/clippy/tests/ui/same_name_method.rs b/src/tools/clippy/tests/ui/same_name_method.rs
index 1c166a19b0a..26b1a299ba1 100644
--- a/src/tools/clippy/tests/ui/same_name_method.rs
+++ b/src/tools/clippy/tests/ui/same_name_method.rs
@@ -74,6 +74,7 @@ mod should_lint {
         impl S {
             fn foo() {}
             //~^ ERROR: method's name is the same as an existing method in a trait
+            //~| ERROR: method's name is the same as an existing method in a trait
         }
 
         impl T1 for S {}
diff --git a/src/tools/clippy/tests/ui/same_name_method.stderr b/src/tools/clippy/tests/ui/same_name_method.stderr
index 3c5c4a53ad1..82f5ef6a9e8 100644
--- a/src/tools/clippy/tests/ui/same_name_method.stderr
+++ b/src/tools/clippy/tests/ui/same_name_method.stderr
@@ -56,10 +56,22 @@ LL |             fn foo() {}
    |             ^^^^^^^^^^^
    |
 note: existing `foo` defined here
-  --> $DIR/same_name_method.rs:79:9
+  --> $DIR/same_name_method.rs:80:9
    |
 LL |         impl T1 for S {}
    |         ^^^^^^^^^^^^^^^^
 
-error: aborting due to 5 previous errors
+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