rust/tests/ui/matches.stderr

303 lines
9.5 KiB
Plaintext
Raw Normal View History

error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:31:5
|
2018-10-06 16:18:06 +00:00
31 | / match ExprNode::Butterflies {
32 | | ExprNode::ExprAddrOf => Some(&NODE),
33 | | _ => { let x = 5; None },
34 | | }
2017-07-21 08:40:23 +00:00
| |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }`
|
= note: `-D clippy::single-match-else` implied by `-D warnings`
error: you don't need to add `&` to all patterns
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:40:9
|
2018-10-06 16:18:06 +00:00
40 | / match v {
41 | | &Some(v) => println!("{:?}", v),
42 | | &None => println!("none"),
43 | | }
| |_________^
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
2018-10-06 16:18:06 +00:00
40 | match *v {
41 | Some(v) => println!("{:?}", v),
42 | None => println!("none"),
|
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:50:5
|
2018-10-06 16:18:06 +00:00
50 | / match tup {
51 | | &(v, 1) => println!("{}", v),
52 | | _ => println!("none"),
53 | | }
| |_____^ help: try this: `if let &(v, 1) = tup { println!("{}", v) } else { println!("none") }`
error: you don't need to add `&` to all patterns
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:50:5
|
2018-10-06 16:18:06 +00:00
50 | / match tup {
51 | | &(v, 1) => println!("{}", v),
52 | | _ => println!("none"),
53 | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
2018-10-06 16:18:06 +00:00
50 | match *tup {
51 | (v, 1) => println!("{}", v),
|
error: you don't need to add `&` to both the expression and the patterns
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:56:5
|
2018-10-06 16:18:06 +00:00
56 | / match &w {
57 | | &Some(v) => println!("{:?}", v),
58 | | &None => println!("none"),
59 | | }
| |_____^
2018-02-04 12:41:54 +00:00
help: try
|
2018-10-06 16:18:06 +00:00
56 | match w {
57 | Some(v) => println!("{:?}", v),
58 | None => println!("none"),
|
error: you don't need to add `&` to all patterns
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:67:5
2018-04-07 08:23:27 +00:00
|
2018-10-06 16:18:06 +00:00
67 | / if let &None = a {
68 | | println!("none");
69 | | }
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-10-06 16:18:06 +00:00
67 | 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
2018-10-06 16:18:06 +00:00
--> $DIR/matches.rs:72:5
2018-04-07 08:23:27 +00:00
|
2018-10-06 16:18:06 +00:00
72 | / if let &None = &b {
73 | | println!("none");
74 | | }
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-10-06 16:18:06 +00:00
72 | 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:83:9
2018-04-07 08:23:27 +00:00
|
83 | 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:82:18
2018-04-07 08:23:27 +00:00
|
82 | 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:81:18
|
81 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:81:18
|
81 | 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:89:9
|
89 | 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:88:18
|
88 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:87:18
|
87 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:87:18
|
87 | 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:95:9
|
95 | Err(_) => {panic!();}
| ^^^^^^
|
= 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:94:18
|
94 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 12:25:58 +00:00
note: same as this
--> $DIR/matches.rs:93:18
|
93 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 12:25:58 +00:00
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:93:18
|
93 | 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:101:18
2017-09-12 12:25:58 +00:00
|
101 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:100:18
2017-09-12 12:25:58 +00:00
|
100 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:100:18
2017-09-12 12:25:58 +00:00
|
100 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
2017-11-29 14:45:12 +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:108:18
2017-09-12 12:25:58 +00:00
|
108 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:107:18
2017-09-12 12:25:58 +00:00
|
107 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:107:18
2017-09-12 12:25:58 +00:00
|
107 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
2017-11-29 14:45:12 +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:114:18
2017-09-12 12:25:58 +00:00
|
114 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:113:18
2017-09-12 12:25:58 +00:00
|
113 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:113:18
2017-09-12 12:25:58 +00:00
|
113 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
2017-11-29 14:45:12 +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:120:18
2017-09-12 12:25:58 +00:00
|
120 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:119:18
2017-09-12 12:25:58 +00:00
|
119 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:119:18
2017-09-12 12:25:58 +00:00
|
119 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
2017-11-29 14:45:12 +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
2017-11-29 20:52:49 +00:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:141:29
2017-11-29 20:52:49 +00:00
|
141 | (Ok(_), Some(x)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:140:29
|
140 | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
--> $DIR/matches.rs:140:29
|
140 | (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:156:18
|
156 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:155:18
|
155 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:155:18
|
155 | 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:163:33
2017-12-19 22:22:16 +00:00
|
163 | let borrowed: Option<&()> = match owned {
2017-12-20 09:39:48 +00:00
| _________________________________^
164 | | None => None,
165 | | Some(ref v) => Some(v),
166 | | };
2017-12-19 22:22:16 +00:00
| |_____^ 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:169:39
2017-12-19 22:22:16 +00:00
|
169 | let borrow_mut: Option<&mut ()> = match mut_owned {
2017-12-20 09:39:48 +00:00
| _______________________________________^
170 | | None => None,
171 | | Some(ref mut v) => Some(v),
172 | | };
2017-12-20 09:39:48 +00:00
| |_____^ help: try this: `mut_owned.as_mut()`
2017-12-19 22:22:16 +00:00
error: aborting due to 21 previous errors
2018-01-16 16:06:27 +00:00