Skip to content

Commit

Permalink
Auto merge of rust-lang#111916 - fee1-dead-contrib:noop-method-call-w…
Browse files Browse the repository at this point in the history
…arn, r=compiler-errors

make `noop_method_call` warn by default

r? `@compiler-errors`
  • Loading branch information
bors committed Jul 29, 2023
2 parents 4c9d68e + 1662fdb commit 0c0026e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions tests/ui/explicit_deref_methods.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![allow(
clippy::borrow_deref_ref,
suspicious_double_ref_op,
noop_method_call,
clippy::explicit_auto_deref,
clippy::needless_borrow,
clippy::no_effect,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/explicit_deref_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![allow(
clippy::borrow_deref_ref,
suspicious_double_ref_op,
noop_method_call,
clippy::explicit_auto_deref,
clippy::needless_borrow,
clippy::no_effect,
Expand Down
24 changes: 12 additions & 12 deletions tests/ui/explicit_deref_methods.stderr
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:54:19
--> $DIR/explicit_deref_methods.rs:55:19
|
LL | let b: &str = a.deref();
| ^^^^^^^^^ help: try: `&*a`
|
= note: `-D clippy::explicit-deref-methods` implied by `-D warnings`

error: explicit `deref_mut` method call
--> $DIR/explicit_deref_methods.rs:56:23
--> $DIR/explicit_deref_methods.rs:57:23
|
LL | let b: &mut str = a.deref_mut();
| ^^^^^^^^^^^^^ help: try: `&mut **a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:59:39
--> $DIR/explicit_deref_methods.rs:60:39
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
| ^^^^^^^^^ help: try: `&*a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:59:50
--> $DIR/explicit_deref_methods.rs:60:50
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
| ^^^^^^^^^ help: try: `&*a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:61:20
--> $DIR/explicit_deref_methods.rs:62:20
|
LL | println!("{}", a.deref());
| ^^^^^^^^^ help: try: `&*a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:64:11
--> $DIR/explicit_deref_methods.rs:65:11
|
LL | match a.deref() {
| ^^^^^^^^^ help: try: `&*a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:68:28
--> $DIR/explicit_deref_methods.rs:69:28
|
LL | let b: String = concat(a.deref());
| ^^^^^^^^^ help: try: `&*a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:70:13
--> $DIR/explicit_deref_methods.rs:71:13
|
LL | let b = just_return(a).deref();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:72:28
--> $DIR/explicit_deref_methods.rs:73:28
|
LL | let b: String = concat(just_return(a).deref());
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:74:19
--> $DIR/explicit_deref_methods.rs:75:19
|
LL | let b: &str = a.deref().deref();
| ^^^^^^^^^^^^^^^^^ help: try: `&**a`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:77:13
--> $DIR/explicit_deref_methods.rs:78:13
|
LL | let b = opt_a.unwrap().deref();
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*opt_a.unwrap()`

error: explicit `deref` method call
--> $DIR/explicit_deref_methods.rs:114:31
--> $DIR/explicit_deref_methods.rs:115:31
|
LL | let b: &str = expr_deref!(a.deref());
| ^^^^^^^^^ help: try: `&*a`
Expand Down

0 comments on commit 0c0026e

Please sign in to comment.