rust/tests/ui/matches.stderr

427 lines
13 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 10:40:23 +02: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: this boolean expression can be simplified
--> $DIR/matches.rs:51:11
|
51 | match test && test {
| ^^^^^^^^^^^^ help: try: `test`
|
= note: `-D nonminimal-bool` implied by `-D warnings`
2018-03-28 23:49:32 +02:00
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:30:5
|
30 | / match test {
31 | | true => 0,
32 | | false => 42,
33 | | };
2017-07-21 10:40:23 +02:00
| |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }`
|
= note: `-D match-bool` implied by `-D warnings`
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:36:5
|
36 | / match option == 1 {
37 | | true => 1,
38 | | false => 0,
39 | | };
| |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }`
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:41:5
|
41 | / match test {
42 | | true => (),
43 | | false => { println!("Noooo!"); }
44 | | };
| |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:46:5
|
46 | / match test {
47 | | false => { println!("Noooo!"); }
48 | | _ => (),
49 | | };
| |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:51:5
|
51 | / match test && test {
52 | | false => { println!("Noooo!"); }
53 | | _ => (),
54 | | };
| |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }`
error: equal expressions as operands to `&&`
--> $DIR/matches.rs:51:11
|
51 | match test && test {
| ^^^^^^^^^^^^
|
= note: `-D eq-op` implied by `-D warnings`
error: you seem to be trying to match on a boolean expression
--> $DIR/matches.rs:56:5
|
56 | / match test {
57 | | false => { println!("Noooo!"); }
58 | | true => { println!("Yes!"); }
59 | | };
| |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }`
error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:72:9
|
72 | / match v {
73 | | &Some(v) => println!("{:?}", v),
74 | | &None => println!("none"),
75 | | }
| |_________^
|
= note: `-D match-ref-pats` implied by `-D warnings`
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
72 | match *v {
73 | Some(v) => println!("{:?}", v),
74 | None => println!("none"),
|
error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:82:5
|
82 | / match tup {
83 | | &(v, 1) => println!("{}", v),
84 | | _ => println!("none"),
85 | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
82 | match *tup {
83 | (v, 1) => println!("{}", v),
|
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:88:5
|
88 | / match &w {
89 | | &Some(v) => println!("{:?}", v),
90 | | &None => println!("none"),
91 | | }
| |_____^
2018-02-04 13:41:54 +01:00
help: try
|
88 | match w {
89 | Some(v) => println!("{:?}", v),
90 | None => println!("none"),
|
error: you don't need to add `&` to all patterns
--> $DIR/matches.rs:99:5
|
99 | / if let &None = a {
100 | | println!("none");
101 | | }
| |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
2017-07-10 15:29:29 +02:00
|
99 | if let None = *a {
2017-11-10 08:58:54 +01:00
|
error: you don't need to add `&` to both the expression and the patterns
--> $DIR/matches.rs:104:5
|
104 | / if let &None = &b {
105 | | println!("none");
106 | | }
2018-02-04 13:41:54 +01:00
| |_____^
help: try
|
104 | if let None = b {
2018-02-04 13:41:54 +01:00
|
error: some ranges overlap
--> $DIR/matches.rs:113:9
|
113 | 0 ... 10 => println!("0 ... 10"),
| ^^^^^^^^
|
= note: `-D match-overlapping-arm` implied by `-D warnings`
note: overlaps with this
--> $DIR/matches.rs:114:9
|
114 | 0 ... 11 => println!("0 ... 11"),
| ^^^^^^^^
error: some ranges overlap
--> $DIR/matches.rs:119:9
|
119 | 0 ... 5 => println!("0 ... 5"),
| ^^^^^^^
|
note: overlaps with this
--> $DIR/matches.rs:121:9
|
121 | FOO ... 11 => println!("0 ... 11"),
| ^^^^^^^^^^
error: some ranges overlap
--> $DIR/matches.rs:127:9
|
127 | 0 ... 5 => println!("0 ... 5"),
| ^^^^^^^
|
note: overlaps with this
--> $DIR/matches.rs:126:9
|
126 | 2 => println!("2"),
| ^
error: some ranges overlap
--> $DIR/matches.rs:133:9
|
133 | 0 ... 2 => println!("0 ... 2"),
| ^^^^^^^
|
note: overlaps with this
--> $DIR/matches.rs:132:9
|
132 | 2 => println!("2"),
| ^
error: some ranges overlap
--> $DIR/matches.rs:156:9
|
156 | 0 .. 11 => println!("0 .. 11"),
| ^^^^^^^
|
note: overlaps with this
--> $DIR/matches.rs:157:9
|
157 | 0 ... 11 => println!("0 ... 11"),
| ^^^^^^^^
2017-02-11 07:57:50 +01:00
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:174:9
2017-02-11 07:57:50 +01:00
|
174 | Err(_) => panic!("err")
2017-02-11 07:57:50 +01:00
| ^^^^^^
|
= note: `-D match-wild-err-arm` implied by `-D warnings`
2017-02-11 07:57:50 +01:00
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:173:18
2017-09-12 14:25:58 +02:00
|
173 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
= note: `-D match-same-arms` implied by `-D warnings`
note: same as this
--> $DIR/matches.rs:172:18
2017-09-12 14:25:58 +02:00
|
172 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:172:18
2017-09-12 14:25:58 +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
2017-02-11 07:57:50 +01:00
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:180:9
2017-02-11 07:57:50 +01:00
|
180 | Err(_) => {panic!()}
2017-02-11 07:57:50 +01:00
| ^^^^^^
|
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:179:18
2017-09-12 14:25:58 +02:00
|
179 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:178:18
2017-09-12 14:25:58 +02:00
|
178 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:178:18
2017-09-12 14:25:58 +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-02-11 14:42:42 +01:00
error: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:186:9
2017-02-11 14:42:42 +01:00
|
186 | Err(_) => {panic!();}
2017-02-11 14:42:42 +01:00
| ^^^^^^
|
= note: to remove this warning, match each error seperately or use unreachable macro
2017-09-12 14:25:58 +02:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:185:18
2017-09-12 14:25:58 +02:00
|
185 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:184:18
2017-09-12 14:25:58 +02:00
|
184 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:184:18
2017-09-12 14:25:58 +02:00
|
184 | 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
--> $DIR/matches.rs:192:18
2017-09-12 14:25:58 +02:00
|
192 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:191:18
2017-09-12 14:25:58 +02:00
|
191 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:191:18
2017-09-12 14:25:58 +02:00
|
191 | 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
--> $DIR/matches.rs:199:18
2017-09-12 14:25:58 +02:00
|
199 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:198:18
2017-09-12 14:25:58 +02:00
|
198 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:198:18
2017-09-12 14:25:58 +02:00
|
198 | 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
--> $DIR/matches.rs:205:18
2017-09-12 14:25:58 +02:00
|
205 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:204:18
2017-09-12 14:25:58 +02:00
|
204 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:204:18
2017-09-12 14:25:58 +02:00
|
204 | 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
--> $DIR/matches.rs:211:18
2017-09-12 14:25:58 +02:00
|
211 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:210:18
2017-09-12 14:25:58 +02:00
|
210 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:210:18
2017-09-12 14:25:58 +02:00
|
210 | 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
--> $DIR/matches.rs:232:29
2017-11-29 21:52:49 +01:00
|
232 | (Ok(_), Some(x)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:231:29
|
231 | (Ok(x), Some(_)) => println!("ok {}", x),
| ^^^^^^^^^^^^^^^^^^^^
note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
--> $DIR/matches.rs:231:29
|
231 | (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:247:18
|
247 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:246:18
|
246 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:246:18
|
246 | 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
--> $DIR/matches.rs:254:33
2017-12-19 23:22:16 +01:00
|
254 | let borrowed: Option<&()> = match owned {
2017-12-20 10:39:48 +01:00
| _________________________________^
255 | | None => None,
256 | | Some(ref v) => Some(v),
257 | | };
2017-12-19 23:22:16 +01:00
| |_____^ help: try this: `owned.as_ref()`
|
= note: `-D match-as-ref` implied by `-D warnings`
2017-12-20 10:39:48 +01:00
error: use as_mut() instead
--> $DIR/matches.rs:260:39
2017-12-19 23:22:16 +01:00
|
260 | let borrow_mut: Option<&mut ()> = match mut_owned {
2017-12-20 10:39:48 +01:00
| _______________________________________^
261 | | None => None,
262 | | Some(ref mut v) => Some(v),
263 | | };
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 33 previous errors
2018-01-16 17:06:27 +01:00