mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Auto merge of #111916 - fee1-dead-contrib:noop-method-call-warn, r=compiler-errors
make `noop_method_call` warn by default r? `@compiler-errors`
This commit is contained in:
commit
0c0026e380
3 changed files with 14 additions and 12 deletions
|
@ -4,6 +4,7 @@
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::borrow_deref_ref,
|
clippy::borrow_deref_ref,
|
||||||
suspicious_double_ref_op,
|
suspicious_double_ref_op,
|
||||||
|
noop_method_call,
|
||||||
clippy::explicit_auto_deref,
|
clippy::explicit_auto_deref,
|
||||||
clippy::needless_borrow,
|
clippy::needless_borrow,
|
||||||
clippy::no_effect,
|
clippy::no_effect,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::borrow_deref_ref,
|
clippy::borrow_deref_ref,
|
||||||
suspicious_double_ref_op,
|
suspicious_double_ref_op,
|
||||||
|
noop_method_call,
|
||||||
clippy::explicit_auto_deref,
|
clippy::explicit_auto_deref,
|
||||||
clippy::needless_borrow,
|
clippy::needless_borrow,
|
||||||
clippy::no_effect,
|
clippy::no_effect,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: explicit `deref` method call
|
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();
|
LL | let b: &str = a.deref();
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
@ -7,67 +7,67 @@ LL | let b: &str = a.deref();
|
||||||
= note: `-D clippy::explicit-deref-methods` implied by `-D warnings`
|
= note: `-D clippy::explicit-deref-methods` implied by `-D warnings`
|
||||||
|
|
||||||
error: explicit `deref_mut` method call
|
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();
|
LL | let b: &mut str = a.deref_mut();
|
||||||
| ^^^^^^^^^^^^^ help: try: `&mut **a`
|
| ^^^^^^^^^^^^^ help: try: `&mut **a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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());
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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());
|
LL | let b: String = format!("{}, {}", a.deref(), a.deref());
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
error: explicit `deref` method call
|
||||||
--> $DIR/explicit_deref_methods.rs:61:20
|
--> $DIR/explicit_deref_methods.rs:62:20
|
||||||
|
|
|
|
||||||
LL | println!("{}", a.deref());
|
LL | println!("{}", a.deref());
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
error: explicit `deref` method call
|
||||||
--> $DIR/explicit_deref_methods.rs:64:11
|
--> $DIR/explicit_deref_methods.rs:65:11
|
||||||
|
|
|
|
||||||
LL | match a.deref() {
|
LL | match a.deref() {
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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());
|
LL | let b: String = concat(a.deref());
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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();
|
LL | let b = just_return(a).deref();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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());
|
LL | let b: String = concat(just_return(a).deref());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `just_return(a)`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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();
|
LL | let b: &str = a.deref().deref();
|
||||||
| ^^^^^^^^^^^^^^^^^ help: try: `&**a`
|
| ^^^^^^^^^^^^^^^^^ help: try: `&**a`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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();
|
LL | let b = opt_a.unwrap().deref();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*opt_a.unwrap()`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*opt_a.unwrap()`
|
||||||
|
|
||||||
error: explicit `deref` method call
|
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());
|
LL | let b: &str = expr_deref!(a.deref());
|
||||||
| ^^^^^^^^^ help: try: `&*a`
|
| ^^^^^^^^^ help: try: `&*a`
|
||||||
|
|
Loading…
Reference in a new issue