Repository: rust
Issue: `self.to_string().eq(other.to_string())` where `other: &Self` and `Self: Display` suggests removing `.to_string()` instead of taking reference
Labels: A-diagnostics,T-compiler

### Code

```Rust
#[derive(Debug)]
struct Error;

impl std::fmt::Display for Error {
    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(fmt, "Error")
    }
}

impl std::error::Error for Error {}

// This error instead of suggesting adding an & in front of `other.to_string()`, suggests removing `.to_string()`:

// error[E0308]: mismatched types
//    --> src/lib.rs:14:29
//     |
// 14  |         self.to_string().eq(other.to_string())
//     |                          -- ^^^^^^^^^^^^^^^^^ expected `&_`, found `String`
//     |                          |
//     |                          arguments to this method are incorrect
//     |
//     = note: expected reference `&_`
//                   found struct `String`
// note: method defined here
//    --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:255:8
//     |
// 255 |     fn eq(&self, other: &Rhs) -> bool;
//     |        ^^
// help: try removing the method call
//     |
// 14  -         self.to_string().eq(other.to_string())
// 14  +         self.to_string().eq(other)
//     |
//

impl PartialEq for Error {
    fn eq(&self, other: &Self) -> bool {
        self.to_string().eq(other.to_string())
    }
}

// Changing to the error suggestion though:

// error[E0277]: can't compare `String` with `Error`
//   --> src/lib.rs:42:29
//    |
// 42 |         self.to_string().eq(other)
//    |                          -- ^^^^^ no implementation for `String == Error`
//    |                          |
//    |                          required by a bound introduced by this call
//    |
//    = help: the trait `PartialEq<Error>` is not implemented for `String`
//    = help: the following other types implement trait `PartialEq<Rhs>`:
//              <String as PartialEq<&'a str>>
//              <String as PartialEq<Cow<'a, str>>>
//              <String as PartialEq<str>>
//              <String as PartialEq>
//
//impl PartialEq for Error {
//    fn eq(&self, other: &Self) -> bool {
//        self.to_string().eq(other)
//    }
//}
```


### Current output

```Shell
error[E0308]: mismatched types
    --> src/lib.rs:14:29
     |
 14  |         self.to_string().eq(other.to_string())
     |                          -- ^^^^^^^^^^^^^^^^^ expected `&_`, found `String`
     |                          |
     |                          arguments to this method are incorrect
     |
     = note: expected reference `&_`
                   found struct `String`
 note: method defined here
    --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:255:8
     |
 255 |     fn eq(&self, other: &Rhs) -> bool;
     |        ^^
 help: try removing the method call
     |
 14  -         self.to_string().eq(other.to_string())
 14  +         self.to_string().eq(other)
     |
```


### Desired output

```Shell
error[E0308]: mismatched types
    --> src/lib.rs:14:29
     |
 14  |         self.to_string().eq(other.to_string())
     |                          -- ^^^^^^^^^^^^^^^^^ expected `&_`, found `String`
     |                          |
     |                          arguments to this method are incorrect
     |
     = note: expected reference `&_`
                   found struct `String`
 note: method defined here
    --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:255:8
     |
 255 |     fn eq(&self, other: &Rhs) -> bool;
     |        ^^
 help: try taking a reference
     |
 14  -         self.to_string().eq(other.to_string())
 14  +         self.to_string().eq(&other.to_string())
     |
```


### Rationale and extra context

_No response_

### Other cases

_No response_

### Rust Version

```Shell
From play.rust-lang.org:

Build using the Nightly version: 1.82.0-nightly (2024-08-05 e57f3090aec33cdbf660)
```


### Anything else?

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4fd462b1a41f891f83bfc1b66d0beef6