rust-clippy/tests/ui/matches.stderr

355 lines
10 KiB
Text
Raw Normal View History

error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/matches.rs:21:5
|
21 | / match ExprNode::Butterflies {
22 | | ExprNode::ExprAddrOf => Some(&NODE),
23 | | _ => { let x = 5; None },
24 | | }
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 single-match-else` implied by `-D warnings`
error: you don't need to add `&` to all patterns
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:30:9
|
2018-04-07 08:23:27 +00:00
30 | / match v {
31 | | &Some(v) => println!("{:?}", v),
32 | | &None => println!("none"),
33 | | }
| |_________^
|
= note: `-D match-ref-pats` implied by `-D warnings`
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
2018-04-07 08:23:27 +00:00
30 | match *v {
31 | Some(v) => println!("{:?}", v),
32 | None => println!("none"),
|
error: you don't need to add `&` to all patterns
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:40:5
|
2018-04-07 08:23:27 +00:00
40 | / match tup {
41 | | &(v, 1) => println!("{}", v),
42 | | _ => println!("none"),
43 | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
2018-04-07 08:23:27 +00:00
40 | match *tup {
41 | (v, 1) => println!("{}", v),
|
error: you don't need to add `&` to both the expression and the patterns
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:46:5
|
2018-04-07 08:23:27 +00:00
46 | / match &w {
47 | | &Some(v) => println!("{:?}", v),
48 | | &None => println!("none"),
49 | | }
| |_____^
2018-02-04 12:41:54 +00:00
help: try
|
2018-04-07 08:23:27 +00:00
46 | match w {
47 | Some(v) => println!("{:?}", v),
48 | None => println!("none"),
|
error: you don't need to add `&` to all patterns
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:57:5
|
57 | / if let &None = a {
58 | | println!("none");
59 | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
2018-04-07 08:23:27 +00:00
|
57 | if let None = *a {
|
error: you don't need to add `&` to both the expression and the patterns
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:62:5
|
62 | / if let &None = &b {
63 | | println!("none");
64 | | }
| |_____^
2018-02-04 12:41:54 +00:00
help: try
2018-04-07 08:23:27 +00:00
|
62 | if let None = b {
|
error: some ranges overlap
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:71:9
|
71 | 0 ... 10 => println!("0 ... 10"),
| ^^^^^^^^
|
= note: `-D match-overlapping-arm` implied by `-D warnings`
note: overlaps with this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:72:9
|
72 | 0 ... 11 => println!("0 ... 11"),
| ^^^^^^^^
error: some ranges overlap
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:77:9
|
77 | 0 ... 5 => println!("0 ... 5"),
| ^^^^^^^
|
note: overlaps with this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:79:9
|
79 | FOO ... 11 => println!("0 ... 11"),
| ^^^^^^^^^^
error: some ranges overlap
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:85:9
|
85 | 0 ... 5 => println!("0 ... 5"),
| ^^^^^^^
|
note: overlaps with this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:84:9
|
84 | 2 => println!("2"),
| ^
error: some ranges overlap
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:91:9
|
91 | 0 ... 2 => println!("0 ... 2"),
| ^^^^^^^
|
note: overlaps with this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:90:9
|
90 | 2 => println!("2"),
| ^
error: some ranges overlap
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:114:9
|
2018-04-07 08:23:27 +00:00
114 | 0 .. 11 => println!("0 .. 11"),
| ^^^^^^^
|
note: overlaps with this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:115:9
|
2018-04-07 08:23:27 +00:00
115 | 0 ... 11 => println!("0 ... 11"),
| ^^^^^^^^
2017-02-11 06:57:50 +00:00
error: Err(_) will match all errors, maybe not a good idea
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:132:9
2017-02-11 06:57:50 +00:00
|
2018-04-07 08:23:27 +00:00
132 | Err(_) => panic!("err")
2017-02-11 06:57:50 +00:00
| ^^^^^^
|
= note: `-D match-wild-err-arm` implied by `-D warnings`
2017-02-11 06:57:50 +00:00
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:131:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
131 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
= note: `-D match-same-arms` implied by `-D warnings`
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:130:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
130 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:130:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
130 | 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-02-11 06:57:50 +00:00
error: Err(_) will match all errors, maybe not a good idea
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:138:9
2017-02-11 06:57:50 +00:00
|
2018-04-07 08:23:27 +00:00
138 | Err(_) => {panic!()}
2017-02-11 06:57:50 +00:00
| ^^^^^^
|
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:137:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
137 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:136:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
136 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:136:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
136 | 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-02-11 13:42:42 +00:00
error: Err(_) will match all errors, maybe not a good idea
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:144:9
2017-02-11 13:42:42 +00:00
|
2018-04-07 08:23:27 +00:00
144 | Err(_) => {panic!();}
2017-02-11 13:42:42 +00:00
| ^^^^^^
|
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 12:25:58 +00:00
error: this `match` has identical arm bodies
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:143:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
143 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:142:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
142 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:142:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
142 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:150:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
150 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:149:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
149 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:149:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
149 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:157:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
157 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:156:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
156 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:156:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
156 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:163:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
163 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:162:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
162 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:162:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
162 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:169:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
169 | Ok(_) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:168:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
168 | Ok(3) => println!("ok"),
2017-09-12 12:25:58 +00:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:168:18
2017-09-12 12:25:58 +00:00
|
2018-04-07 08:23:27 +00:00
168 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:190:29
2017-11-29 20:52:49 +00:00
|
2018-04-07 08:23:27 +00:00
190 | (Ok(_), Some(x)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:189:29
|
2018-04-07 08:23:27 +00:00
189 | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:189:29
|
2018-04-07 08:23:27 +00:00
189 | (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-04-07 08:23:27 +00:00
--> $DIR/matches.rs:205:18
|
2018-04-07 08:23:27 +00:00
205 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
note: same as this
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:204:18
|
2018-04-07 08:23:27 +00:00
204 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:204:18
|
2018-04-07 08:23:27 +00:00
204 | 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
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:212:33
2017-12-19 22:22:16 +00:00
|
2018-04-07 08:23:27 +00:00
212 | let borrowed: Option<&()> = match owned {
2017-12-20 09:39:48 +00:00
| _________________________________^
2018-04-07 08:23:27 +00:00
213 | | None => None,
214 | | Some(ref v) => Some(v),
215 | | };
2017-12-19 22:22:16 +00:00
| |_____^ help: try this: `owned.as_ref()`
|
= note: `-D match-as-ref` implied by `-D warnings`
2017-12-20 09:39:48 +00:00
error: use as_mut() instead
2018-04-07 08:23:27 +00:00
--> $DIR/matches.rs:218:39
2017-12-19 22:22:16 +00:00
|
2018-04-07 08:23:27 +00:00
218 | let borrow_mut: Option<&mut ()> = match mut_owned {
2017-12-20 09:39:48 +00:00
| _______________________________________^
2018-04-07 08:23:27 +00:00
219 | | None => None,
220 | | Some(ref mut v) => Some(v),
221 | | };
2017-12-20 09:39:48 +00:00
| |_____^ help: try this: `mut_owned.as_mut()`
2017-12-19 22:22:16 +00:00
2018-04-07 08:23:27 +00:00
error: aborting due to 25 previous errors
2018-01-16 16:06:27 +00:00