rust-clippy/tests/ui/matches.stderr

297 lines
9 KiB
Text
Raw Normal View History

error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:11:9
|
2018-12-27 15:57:55 +00:00
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
|
2018-12-27 15:57:55 +00:00
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
|
2018-12-27 15:57:55 +00:00
LL | / match tup {
LL | | &(v, 1) => println!("{}", v),
LL | | _ => println!("none"),
LL | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
2018-12-27 15:57:55 +00:00
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
|
2018-12-27 15:57:55 +00:00
LL | / match &w {
LL | | &Some(v) => println!("{:?}", v),
LL | | &None => println!("none"),
LL | | }
| |_____^
2018-02-04 12:41:54 +00:00
help: try
|
2018-12-27 15:57:55 +00:00
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
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | / if let &None = a {
LL | | println!("none");
LL | | }
2018-04-07 08:23:27 +00:00
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | if let None = *a {
2018-05-29 08:56:58 +00:00
| ^^^^ ^^
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:44:5
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | / if let &None = &b {
LL | | println!("none");
LL | | }
2018-04-07 08:23:27 +00:00
| |_____^
2018-02-04 12:41:54 +00:00
help: try
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | if let None = b {
2018-05-29 08:56:58 +00:00
| ^^^^ ^
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:55:9
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | Err(_) => panic!("err"),
| ^^^^^^
2018-04-07 08:23:27 +00:00
|
= 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
2018-04-07 08:23:27 +00:00
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
2018-04-07 08:23:27 +00:00
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:53:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:53:18
|
2018-12-27 15:57:55 +00:00
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)
2017-09-12 12:25:58 +00:00
2017-02-11 06:57:50 +00:00
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:61:9
|
2018-12-27 15:57:55 +00:00
LL | Err(_) => panic!(),
| ^^^^^^
|
= note: to remove this warning, match each error separately or use unreachable macro
2017-02-11 06:57:50 +00:00
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:60:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:59:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:59:18
|
2018-12-27 15:57:55 +00:00
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)
2017-09-12 12:25:58 +00:00
2017-02-11 13:42:42 +00:00
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:67:9
|
2018-12-27 15:57:55 +00:00
LL | Err(_) => {
| ^^^^^^
|
= note: to remove this warning, match each error separately or use unreachable macro
2017-02-11 13:42:42 +00:00
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:66:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:65:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:65:18
|
2018-12-27 15:57:55 +00:00
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)
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:75:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:74:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:74:18
|
2018-12-27 15:57:55 +00:00
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)
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:82:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:81:18
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:81:18
|
2018-12-27 15:57:55 +00:00
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)
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:88:18
2018-12-10 05:27:19 +00:00
|
2018-12-27 15:57:55 +00:00
LL | Ok(_) => println!("ok"),
2018-12-10 05:27:19 +00:00
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:87:18
2018-12-10 05:27:19 +00:00
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
2018-12-10 05:27:19 +00:00
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:87:18
2018-12-10 05:27:19 +00:00
|
2018-12-27 15:57:55 +00:00
LL | Ok(3) => println!("ok"),
2018-12-10 05:27:19 +00:00
| ^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:94:18
2018-12-27 15:57:55 +00:00
|
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:93:18
2018-12-27 15:57:55 +00:00
|
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:93:18
2018-12-27 15:57:55 +00:00
|
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)
2017-09-12 12:25:58 +00:00
2017-11-29 20:52:49 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:117:29
2018-12-27 15:57:55 +00:00
|
LL | (Ok(_), Some(x)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:116:29
2018-12-27 15:57:55 +00:00
|
LL | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
--> $DIR/matches.rs:116:29
2018-12-27 15:57:55 +00:00
|
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
2018-12-27 15:57:55 +00:00
|
LL | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:131:18
2018-12-27 15:57:55 +00:00
|
LL | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:131:18
2018-12-27 15:57:55 +00:00
|
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)
2017-12-19 22:22:16 +00:00
error: use as_ref() instead
--> $DIR/matches.rs:141:33
2018-12-27 15:57:55 +00:00
|
LL | let borrowed: Option<&()> = match owned {
| _________________________________^
LL | | None => None,
LL | | Some(ref v) => Some(v),
LL | | };
| |_____^ help: try this: `owned.as_ref()`
|
= note: `-D clippy::match-as-ref` implied by `-D warnings`
2017-12-19 22:22:16 +00:00
2017-12-20 09:39:48 +00:00
error: use as_mut() instead
--> $DIR/matches.rs:147:39
2018-12-27 15:57:55 +00:00
|
LL | let borrow_mut: Option<&mut ()> = match mut_owned {
| _______________________________________^
LL | | None => None,
LL | | Some(ref mut v) => Some(v),
LL | | };
| |_____^ help: try this: `mut_owned.as_mut()`
2017-12-19 22:22:16 +00:00
error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:174: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 20 previous errors
2018-01-16 16:06:27 +00:00