rust/tests/ui/explicit_deref_methods.stderr
Jason Newcomb a261bc5fad
Make explicit_deref_methods check for multiple deref calls
Fix suggestion for `explicit_deref_methods`. Sometimes `&**` is needed, sometimes nothing is needed.
Allow `explicit_deref_methods` to trigger in a few new contexts.
`explicit_deref_methods` will now consider ufcs calls
2021-03-13 08:39:48 -05:00

71 lines
2.2 KiB
Plaintext

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:30:19
|
LL | let b: &str = a.deref();
| ^^^^^^^^^ help: try this: `&*a`
|
= note: `-D clippy::explicit-deref-methods` implied by `-D warnings`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:32:23
|
LL | let b: &mut str = a.deref_mut();
| ^^^^^^^^^^^^^ help: try this: `&mut **a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:35:39
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
| ^^^^^^^^^ help: try this: `&*a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:35:50
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
| ^^^^^^^^^ help: try this: `&*a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:37:20
|
LL | println!("{}", a.deref());
| ^^^^^^^^^ help: try this: `&*a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:40:11
|
LL | match a.deref() {
| ^^^^^^^^^ help: try this: `&*a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:44:28
|
LL | let b: String = concat(a.deref());
| ^^^^^^^^^ help: try this: `&*a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:46:13
|
LL | let b = just_return(a).deref();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `just_return(a)`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:48:28
|
LL | let b: String = concat(just_return(a).deref());
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `just_return(a)`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:50:19
|
LL | let b: &str = a.deref().deref();
| ^^^^^^^^^^^^^^^^^ help: try this: `&**a`
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:53:13
|
LL | let b = opt_a.unwrap().deref();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&*opt_a.unwrap()`
error: aborting due to 11 previous errors