mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
40f36658f5
Changes: - Fix stderr breaking the tests - Adding tests over the if arms
275 lines
8.2 KiB
Plaintext
275 lines
8.2 KiB
Plaintext
error: you don't need to add `&` to all patterns
|
|
--> $DIR/matches.rs:11:9
|
|
|
|
|
LL | / match v {
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
LL | | &None => println!("none"),
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL | match *v {
|
|
LL | Some(v) => println!("{:?}", v),
|
|
LL | None => println!("none"),
|
|
|
|
|
|
|
error: you don't need to add `&` to all patterns
|
|
--> $DIR/matches.rs:22:5
|
|
|
|
|
LL | / match tup {
|
|
LL | | &(v, 1) => println!("{}", v),
|
|
LL | | _ => println!("none"),
|
|
LL | | }
|
|
| |_____^
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL | match *tup {
|
|
LL | (v, 1) => println!("{}", v),
|
|
|
|
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
|
--> $DIR/matches.rs:28:5
|
|
|
|
|
LL | / match &w {
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
LL | | &None => println!("none"),
|
|
LL | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
LL | match w {
|
|
LL | Some(v) => println!("{:?}", v),
|
|
LL | None => println!("none"),
|
|
|
|
|
|
|
error: you don't need to add `&` to all patterns
|
|
--> $DIR/matches.rs:39:5
|
|
|
|
|
LL | / if let &None = a {
|
|
LL | | println!("none");
|
|
LL | | }
|
|
| |_____^
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL | if let None = *a {
|
|
| ^^^^ ^^
|
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
|
--> $DIR/matches.rs:44:5
|
|
|
|
|
LL | / if let &None = &b {
|
|
LL | | println!("none");
|
|
LL | | }
|
|
| |_____^
|
|
help: try
|
|
|
|
|
LL | if let None = b {
|
|
| ^^^^ ^
|
|
|
|
error: Err(_) will match all errors, maybe not a good idea
|
|
--> $DIR/matches.rs:55:9
|
|
|
|
|
LL | Err(_) => panic!("err"),
|
|
| ^^^^^^
|
|
|
|
|
= note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
|
|
= note: to remove this warning, match each error separately or use unreachable macro
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:54:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
|
|
note: same as this
|
|
--> $DIR/matches.rs:53:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:53:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: Err(_) will match all errors, maybe not a good idea
|
|
--> $DIR/matches.rs:61:9
|
|
|
|
|
LL | Err(_) => panic!(),
|
|
| ^^^^^^
|
|
|
|
|
= note: to remove this warning, match each error separately or use unreachable macro
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:60:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:59:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:59:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: Err(_) will match all errors, maybe not a good idea
|
|
--> $DIR/matches.rs:67:9
|
|
|
|
|
LL | Err(_) => {
|
|
| ^^^^^^
|
|
|
|
|
= note: to remove this warning, match each error separately or use unreachable macro
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:66:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:65:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:65:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:75:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:74:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:74:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:82:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:81:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:81:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:88:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:87:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:87:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:94:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:93:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:93:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:117:29
|
|
|
|
|
LL | (Ok(_), Some(x)) => println!("ok {}", x),
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:116:29
|
|
|
|
|
LL | (Ok(x), Some(_)) => println!("ok {}", x),
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
help: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
|
|
--> $DIR/matches.rs:116:9
|
|
|
|
|
LL | (Ok(x), Some(_)) => println!("ok {}", x),
|
|
| ^^^^^^^^^^^^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/matches.rs:132:18
|
|
|
|
|
LL | Ok(_) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/matches.rs:131:18
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^^^^^^^^^^
|
|
help: consider refactoring into `Ok(3) | Ok(_)`
|
|
--> $DIR/matches.rs:131:9
|
|
|
|
|
LL | Ok(3) => println!("ok"),
|
|
| ^^^^^
|
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
|
|
error: you don't need to add `&` to all patterns
|
|
--> $DIR/matches.rs:160:5
|
|
|
|
|
LL | / match foo_variant!(0) {
|
|
LL | | &Foo::A => println!("A"),
|
|
LL | | _ => println!("Wild"),
|
|
LL | | }
|
|
| |_____^
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL | match *foo_variant!(0) {
|
|
LL | Foo::A => println!("A"),
|
|
|
|
|
|
|
error: aborting due to 18 previous errors
|
|
|