rust/tests/ui/matches.stderr

364 lines
11 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 18:18:06 +02:00
--> $DIR/matches.rs:31:5
|
2018-10-06 18:18:06 +02:00
31 | / match ExprNode::Butterflies {
32 | | ExprNode::ExprAddrOf => Some(&NODE),
33 | | _ => { let x = 5; None },
34 | | }
2017-07-21 10:40:23 +02: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 18:18:06 +02:00
--> $DIR/matches.rs:40:9
|
2018-10-06 18:18:06 +02: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 18:18:06 +02: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 18:18:06 +02:00
--> $DIR/matches.rs:50:5
|
2018-10-06 18:18:06 +02:00
50 | / match tup {
51 | | &(v, 1) => println!("{}", v),
52 | | _ => println!("none"),
53 | | }
2018-08-02 23:14:48 +02:00
| |_____^ help: try this: `if let &(v, 1) = tup { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; } else { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; }`
error: you don't need to add `&` to all patterns
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:50:5
|
2018-10-06 18:18:06 +02: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 18:18:06 +02: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 18:18:06 +02:00
--> $DIR/matches.rs:56:5
|
2018-10-06 18:18:06 +02:00
56 | / match &w {
57 | | &Some(v) => println!("{:?}", v),
58 | | &None => println!("none"),
59 | | }
| |_____^
2018-02-04 13:41:54 +01:00
help: try
|
2018-10-06 18:18:06 +02: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 18:18:06 +02:00
--> $DIR/matches.rs:67:5
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
67 | / if let &None = a {
68 | | println!("none");
69 | | }
2018-04-07 10:23:27 +02:00
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
67 | if let None = *a {
2018-05-29 10:56:58 +02:00
| ^^^^ ^^
error: you don't need to add `&` to both the expression and the patterns
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:72:5
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
72 | / if let &None = &b {
73 | | println!("none");
74 | | }
2018-04-07 10:23:27 +02:00
| |_____^
2018-02-04 13:41:54 +01:00
help: try
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
72 | if let None = b {
2018-05-29 10:56:58 +02:00
| ^^^^ ^
error: some ranges overlap
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:81:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
81 | 0 ... 10 => println!("0 ... 10"),
2018-04-07 10:23:27 +02:00
| ^^^^^^^^
|
= note: `-D clippy::match-overlapping-arm` implied by `-D warnings`
note: overlaps with this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:82:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
82 | 0 ... 11 => println!("0 ... 11"),
2018-04-07 10:23:27 +02:00
| ^^^^^^^^
error: some ranges overlap
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:87:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
87 | 0 ... 5 => println!("0 ... 5"),
2018-04-07 10:23:27 +02:00
| ^^^^^^^
|
note: overlaps with this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:89:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
89 | FOO ... 11 => println!("0 ... 11"),
2018-04-07 10:23:27 +02:00
| ^^^^^^^^^^
error: some ranges overlap
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:95:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
95 | 0 ... 5 => println!("0 ... 5"),
2018-04-07 10:23:27 +02:00
| ^^^^^^^
|
note: overlaps with this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:94:9
2018-04-07 10:23:27 +02:00
|
2018-10-06 18:18:06 +02:00
94 | 2 => println!("2"),
2018-04-07 10:23:27 +02:00
| ^
error: some ranges overlap
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:101:9
|
101 | 0 ... 2 => println!("0 ... 2"),
| ^^^^^^^
|
note: overlaps with this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:100:9
|
100 | 2 => println!("2"),
| ^
error: some ranges overlap
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:124:9
|
2018-10-06 18:18:06 +02:00
124 | 0 .. 11 => println!("0 .. 11"),
| ^^^^^^^
|
note: overlaps with this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:125:9
|
2018-10-06 18:18:06 +02:00
125 | 0 ... 11 => println!("0 ... 11"),
| ^^^^^^^^
2017-02-11 07:57:50 +01:00
error: Err(_) will match all errors, maybe not a good idea
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:142:9
2017-02-11 07:57:50 +01:00
|
2018-10-06 18:18:06 +02:00
142 | Err(_) => panic!("err")
2017-02-11 07:57:50 +01: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
2017-02-11 07:57:50 +01:00
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:141:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
141 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
2017-09-12 14:25:58 +02:00
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:140:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
140 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:140:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
140 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
2017-02-11 07:57:50 +01:00
error: Err(_) will match all errors, maybe not a good idea
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:148:9
2017-02-11 07:57:50 +01:00
|
2018-10-06 18:18:06 +02:00
148 | Err(_) => {panic!()}
2017-02-11 07:57:50 +01:00
| ^^^^^^
|
= note: to remove this warning, match each error separately or use unreachable macro
2017-02-11 07:57:50 +01:00
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:147:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
147 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:146:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
146 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:146:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
146 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
2017-02-11 14:42:42 +01:00
error: Err(_) will match all errors, maybe not a good idea
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:154:9
2017-02-11 14:42:42 +01:00
|
2018-10-06 18:18:06 +02:00
154 | Err(_) => {panic!();}
2017-02-11 14:42:42 +01:00
| ^^^^^^
|
= note: to remove this warning, match each error separately or use unreachable macro
2017-02-11 14:42:42 +01:00
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:153:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
153 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:152:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
152 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:152:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
152 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:160:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
160 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:159:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
159 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:159:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
159 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:167:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
167 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:166:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
166 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:166:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
166 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:173:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
173 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:172:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
172 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:172:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
172 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:179:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
179 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:178:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
178 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:178:18
2017-09-12 14:25:58 +02:00
|
2018-10-06 18:18:06 +02:00
178 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
2017-11-29 15:45:12 +01: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 14:25:58 +02:00
2017-11-29 21:52:49 +01:00
error: this `match` has identical arm bodies
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:200:29
2017-11-29 21:52:49 +01:00
|
2018-10-06 18:18:06 +02:00
200 | (Ok(_), Some(x)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:199:29
|
2018-10-06 18:18:06 +02:00
199 | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:199:29
|
2018-10-06 18:18:06 +02:00
199 | (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
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:215:18
|
2018-10-06 18:18:06 +02:00
215 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
note: same as this
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:214:18
|
2018-10-06 18:18:06 +02:00
214 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:214:18
|
2018-10-06 18:18:06 +02:00
214 | 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 23:22:16 +01:00
error: use as_ref() instead
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:222:33
2017-12-19 23:22:16 +01:00
|
2018-10-06 18:18:06 +02:00
222 | let borrowed: Option<&()> = match owned {
2017-12-20 10:39:48 +01:00
| _________________________________^
2018-10-06 18:18:06 +02:00
223 | | None => None,
224 | | Some(ref v) => Some(v),
225 | | };
2017-12-19 23:22:16 +01:00
| |_____^ help: try this: `owned.as_ref()`
|
= note: `-D clippy::match-as-ref` implied by `-D warnings`
2017-12-19 23:22:16 +01:00
2017-12-20 10:39:48 +01:00
error: use as_mut() instead
2018-10-06 18:18:06 +02:00
--> $DIR/matches.rs:228:39
2017-12-19 23:22:16 +01:00
|
2018-10-06 18:18:06 +02:00
228 | let borrow_mut: Option<&mut ()> = match mut_owned {
2017-12-20 10:39:48 +01:00
| _______________________________________^
2018-10-06 18:18:06 +02:00
229 | | None => None,
230 | | Some(ref mut v) => Some(v),
231 | | };
2017-12-20 10:39:48 +01:00
| |_____^ help: try this: `mut_owned.as_mut()`
2017-12-19 23:22:16 +01:00
error: aborting due to 26 previous errors
2018-01-16 17:06:27 +01:00