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 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 | | }
| |_____^ 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 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: Err(_) will match all errors, maybe not a good idea
--> $DIR/matches.rs:83:9
2018-04-07 10:23:27 +02:00
|
83 | Err(_) => panic!("err")
| ^^^^^^
2018-04-07 10:23:27 +02: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 10:23:27 +02:00
|
82 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
2018-04-07 10:23:27 +02:00
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
2017-09-12 14:25:58 +02:00
note: same as this
--> $DIR/matches.rs:81:18
|
81 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 14:25:58 +02: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 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:89:9
|
89 | Err(_) => {panic!()}
| ^^^^^^
|
= 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
--> $DIR/matches.rs:88:18
|
88 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 14:25:58 +02:00
note: same as this
--> $DIR/matches.rs:87:18
|
87 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 14:25:58 +02: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 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:95:9
|
95 | Err(_) => {panic!();}
| ^^^^^^
|
= 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
--> $DIR/matches.rs:94:18
|
94 | Ok(_) => println!("ok"),
| ^^^^^^^^^^^^^^
|
2017-09-12 14:25:58 +02:00
note: same as this
--> $DIR/matches.rs:93:18
|
93 | Ok(3) => println!("ok"),
| ^^^^^^^^^^^^^^
2017-09-12 14:25:58 +02: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 14:25:58 +02:00
error: this `match` has identical arm bodies
--> $DIR/matches.rs:101:18
2017-09-12 14:25:58 +02:00
|
101 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:100:18
2017-09-12 14:25:58 +02:00
|
100 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:100:18
2017-09-12 14:25:58 +02:00
|
100 | 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:108:18
2017-09-12 14:25:58 +02:00
|
108 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:107:18
2017-09-12 14:25:58 +02:00
|
107 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:107:18
2017-09-12 14:25:58 +02:00
|
107 | 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:114:18
2017-09-12 14:25:58 +02:00
|
114 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:113:18
2017-09-12 14:25:58 +02:00
|
113 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:113:18
2017-09-12 14:25:58 +02:00
|
113 | 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:120:18
2017-09-12 14:25:58 +02:00
|
120 | Ok(_) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
|
note: same as this
--> $DIR/matches.rs:119:18
2017-09-12 14:25:58 +02:00
|
119 | Ok(3) => println!("ok"),
2017-09-12 14:25:58 +02:00
| ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
--> $DIR/matches.rs:119:18
2017-09-12 14:25:58 +02:00
|
119 | 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:141:29
2017-11-29 21:52:49 +01: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 23:22:16 +01:00
error: use as_ref() instead
--> $DIR/matches.rs:163:33
2017-12-19 23:22:16 +01:00
|
163 | let borrowed: Option<&()> = match owned {
2017-12-20 10:39:48 +01:00
| _________________________________^
164 | | None => None,
165 | | Some(ref v) => Some(v),
166 | | };
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
--> $DIR/matches.rs:169:39
2017-12-19 23:22:16 +01:00
|
169 | let borrow_mut: Option<&mut ()> = match mut_owned {
2017-12-20 10:39:48 +01:00
| _______________________________________^
170 | | None => None,
171 | | Some(ref mut v) => Some(v),
172 | | };
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 21 previous errors
2018-01-16 17:06:27 +01:00