-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:26:5
- |
-26 | / match ExprNode::Butterflies {
-27 | | ExprNode::ExprAddrOf => Some(&NODE),
-28 | | _ => { let x = 5; None },
-29 | | }
- | |_____^ 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 seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:35:5
+error: you don't need to add `&` to all patterns
+ --> $DIR/matches.rs:20:9
|
-35 | / match x {
-36 | | Some(y) => { println!("{:?}", y); }
-37 | | _ => ()
-38 | | };
- | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }`
+LL | / match v {
+LL | | &Some(v) => println!("{:?}", v),
+LL | | &None => println!("none"),
+LL | | }
+ | |_________^
|
- = note: `-D single-match` implied by `-D warnings`
-
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:41:5
- |
-41 | / match z {
-42 | | (2...3, 7...9) => dummy(),
-43 | | _ => {}
-44 | | };
- | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }`
-
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:63:5
- |
-63 | / match x {
-64 | | Some(y) => dummy(),
-65 | | None => ()
-66 | | };
- | |_____^ help: try this: `if let Some(y) = x { dummy() }`
-
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:68:5
- |
-68 | / match y {
-69 | | Ok(y) => dummy(),
-70 | | Err(..) => ()
-71 | | };
- | |_____^ help: try this: `if let Ok(y) = y { dummy() }`
-
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
- --> $DIR/matches.rs:75:5
- |
-75 | / match c {
-76 | | Cow::Borrowed(..) => dummy(),
-77 | | Cow::Owned(..) => (),
-78 | | };
- | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
-
-error: you seem to be trying to match on a boolean expression
- --> $DIR/matches.rs:96:5
+ = note: `-D clippy::match-ref-pats` implied by `-D warnings`
+help: instead of prefixing all patterns with `&`, you can dereference the expression
|
-96 | / match test {
-97 | | true => 0,
-98 | | false => 42,
-99 | | };
- | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }`
+LL | match *v {
+LL | Some(v) => println!("{:?}", v),
+LL | None => println!("none"),
|
- = note: `-D match-bool` implied by `-D warnings`
-
-error: you seem to be trying to match on a boolean expression
- --> $DIR/matches.rs:102:5
- |
-102 | / match option == 1 {
-103 | | true => 1,
-104 | | false => 0,
-105 | | };
- | |_____^ 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:107:5
- |
-107 | / match test {
-108 | | true => (),
-109 | | false => { println!("Noooo!"); }
-110 | | };
- | |_____^ 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:112:5
- |
-112 | / match test {
-113 | | false => { println!("Noooo!"); }
-114 | | _ => (),
-115 | | };
- | |_____^ 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:117:5
- |
-117 | / match test && test {
-118 | | false => { println!("Noooo!"); }
-119 | | _ => (),
-120 | | };
- | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }`
-
-error: equal expressions as operands to `&&`
- --> $DIR/matches.rs:117:11
- |
-117 | 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:122:5
- |
-122 | / match test {
-123 | | false => { println!("Noooo!"); }
-124 | | true => { println!("Yes!"); }
-125 | | };
- | |_____^ 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:138:9
- |
-138 | / match v {
-139 | | &Some(v) => println!("{:?}", v),
-140 | | &None => println!("none"),
-141 | | }
- | |_________^
- |
- = note: `-D match-ref-pats` implied by `-D warnings`
-help: instead of prefixing all patterns with `&`, you can dereference the expression
- |
-138 | match *v { .. }
- | ^^^^^^^^^^^^^^^
-
-error: you don't need to add `&` to all patterns
- --> $DIR/matches.rs:148:5
- |
-148 | / match tup {
-149 | | &(v, 1) => println!("{}", v),
-150 | | _ => println!("none"),
-151 | | }
- | |_____^
- |
+ --> $DIR/matches.rs:31:5
+ |
+LL | / match tup {
+LL | | &(v, 1) => println!("{}", v),
+LL | | _ => println!("none"),
+LL | | }
+ | |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
- |
-148 | match *tup { .. }
- | ^^^^^^^^^^^^^^^^^
+ |
+LL | match *tup {
+LL | (v, 1) => println!("{}", v),
+ |
error: you don't need to add `&` to both the expression and the patterns
- --> $DIR/matches.rs:154:5
- |
-154 | / match &w {
-155 | | &Some(v) => println!("{:?}", v),
-156 | | &None => println!("none"),
-157 | | }
- | |_____^ help: try: `match w { .. }`
+ --> $DIR/matches.rs:37:5
+ |
+LL | / match &w {
+LL | | &Some(v) => println!("{:?}", v),
+LL | | &None => println!("none"),
+LL | | }
+ | |_____^
+help: try
+ |
+LL | match w {
+LL | Some(v) => println!("{:?}", v),
+LL | None => println!("none"),
+ |
error: you don't need to add `&` to all patterns
- --> $DIR/matches.rs:165:5
- |
-165 | / if let &None = a {
-166 | | println!("none");
-167 | | }
- | |_____^
- |
+ --> $DIR/matches.rs:48:5
+ |
+LL | / if let &None = a {
+LL | | println!("none");
+LL | | }
+ | |_____^
help: instead of prefixing all patterns with `&`, you can dereference the expression
- |
-165 | if let .. = *a { .. }
- | ^^^^^^^^^^^^^^^^^^^^^
+ |
+LL | if let None = *a {
+ | ^^^^ ^^
error: you don't need to add `&` to both the expression and the patterns
- --> $DIR/matches.rs:170:5
- |
-170 | / if let &None = &b {
-171 | | println!("none");
-172 | | }
- | |_____^ help: try: `if let .. = b { .. }`
-
-error: some ranges overlap
- --> $DIR/matches.rs:179:9
- |
-179 | 0 ... 10 => println!("0 ... 10"),
- | ^^^^^^^^
- |
- = note: `-D match-overlapping-arm` implied by `-D warnings`
-note: overlaps with this
- --> $DIR/matches.rs:180:9
- |
-180 | 0 ... 11 => println!("0 ... 11"),
- | ^^^^^^^^
-
-error: some ranges overlap
- --> $DIR/matches.rs:185:9
- |
-185 | 0 ... 5 => println!("0 ... 5"),
- | ^^^^^^^
- |
-note: overlaps with this
- --> $DIR/matches.rs:187:9
- |
-187 | FOO ... 11 => println!("0 ... 11"),
- | ^^^^^^^^^^
-
-error: some ranges overlap
- --> $DIR/matches.rs:193:9
- |
-193 | 0 ... 5 => println!("0 ... 5"),
- | ^^^^^^^
- |
-note: overlaps with this
- --> $DIR/matches.rs:192:9
- |
-192 | 2 => println!("2"),
- | ^
-
-error: some ranges overlap
- --> $DIR/matches.rs:199:9
- |
-199 | 0 ... 2 => println!("0 ... 2"),
- | ^^^^^^^
- |
-note: overlaps with this
- --> $DIR/matches.rs:198:9
- |
-198 | 2 => println!("2"),
- | ^
-
-error: some ranges overlap
- --> $DIR/matches.rs:222:9
- |
-222 | 0 .. 11 => println!("0 .. 11"),
- | ^^^^^^^
- |
-note: overlaps with this
- --> $DIR/matches.rs:223:9
- |
-223 | 0 ... 11 => println!("0 ... 11"),
- | ^^^^^^^^
+ --> $DIR/matches.rs:53:5
+ |
+LL | / if let &None = &b {
+LL | | println!("none");
+LL | | }
+ | |_____^
+help: try
+ |
+LL | if let None = b {
+ | ^^^^ ^
error: Err(_) will match all errors, maybe not a good idea
- --> $DIR/matches.rs:240:9
- |
-240 | Err(_) => panic!("err")
- | ^^^^^^
- |
- = note: `-D match-wild-err-arm` implied by `-D warnings`
- = note: to remove this warning, match each error seperately or use unreachable macro
+ --> $DIR/matches.rs:64:9
+ |
+LL | Err(_) => panic!("err"),
+ | ^^^^^^
+ |
+ = 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:239:18
- |
-239 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
- = note: `-D match-same-arms` implied by `-D warnings`
+ --> $DIR/matches.rs:63:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `-D clippy::match-same-arms` implied by `-D warnings`
note: same as this
- --> $DIR/matches.rs:238:18
- |
-238 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:62:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:238:18
- |
-238 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:62:18
+ |
+LL | 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)
error: Err(_) will match all errors, maybe not a good idea
- --> $DIR/matches.rs:246:9
- |
-246 | Err(_) => {panic!()}
- | ^^^^^^
- |
- = note: to remove this warning, match each error seperately or use unreachable macro
+ --> $DIR/matches.rs:70:9
+ |
+LL | Err(_) => panic!(),
+ | ^^^^^^
+ |
+ = note: to remove this warning, match each error separately or use unreachable macro
error: this `match` has identical arm bodies
- --> $DIR/matches.rs:245:18
- |
-245 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:69:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:244:18
- |
-244 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:68:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:244:18
- |
-244 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:68:18
+ |
+LL | 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)
error: Err(_) will match all errors, maybe not a good idea
- --> $DIR/matches.rs:252:9
- |
-252 | Err(_) => {panic!();}
- | ^^^^^^
- |
- = note: to remove this warning, match each error seperately or use unreachable macro
+ --> $DIR/matches.rs:76:9
+ |
+LL | Err(_) => {
+ | ^^^^^^
+ |
+ = note: to remove this warning, match each error separately or use unreachable macro
+
+error: this `match` has identical arm bodies
+ --> $DIR/matches.rs:75:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
+note: same as this
+ --> $DIR/matches.rs:74:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+ --> $DIR/matches.rs:74:18
+ |
+LL | 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)
error: this `match` has identical arm bodies
- --> $DIR/matches.rs:251:18
- |
-251 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:84:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:250:18
- |
-250 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:83:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:250:18
- |
-250 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:83:18
+ |
+LL | 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)
error: this `match` has identical arm bodies
- --> $DIR/matches.rs:258:18
- |
-258 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:91:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:257:18
- |
-257 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:90:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:257:18
- |
-257 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:90:18
+ |
+LL | 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)
error: this `match` has identical arm bodies
- --> $DIR/matches.rs:265:18
- |
-265 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:97:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:264:18
- |
-264 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:96:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:264:18
- |
-264 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:96:18
+ |
+LL | 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)
error: this `match` has identical arm bodies
- --> $DIR/matches.rs:271:18
- |
-271 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:103:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:270:18
- |
-270 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:102:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:270:18
- |
-270 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:102:18
+ |
+LL | 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)
+
+error: this `match` has identical arm bodies
+ --> $DIR/matches.rs:126:29
+ |
+LL | (Ok(_), Some(x)) => println!("ok {}", x),
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+note: same as this
+ --> $DIR/matches.rs:125:29
+ |
+LL | (Ok(x), Some(_)) => println!("ok {}", x),
+ | ^^^^^^^^^^^^^^^^^^^^
+note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
+ --> $DIR/matches.rs:125:29
+ |
+LL | (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:277:18
- |
-277 | Ok(_) => println!("ok"),
- | ^^^^^^^^^^^^^^
- |
+ --> $DIR/matches.rs:141:18
+ |
+LL | Ok(_) => println!("ok"),
+ | ^^^^^^^^^^^^^^
+ |
note: same as this
- --> $DIR/matches.rs:276:18
- |
-276 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
+ --> $DIR/matches.rs:140:18
+ |
+LL | Ok(3) => println!("ok"),
+ | ^^^^^^^^^^^^^^
note: consider refactoring into `Ok(3) | Ok(_)`
- --> $DIR/matches.rs:276:18
- |
-276 | Ok(3) => println!("ok"),
- | ^^^^^^^^^^^^^^
- = note: this error originates in a macro outside of the current crate
+ --> $DIR/matches.rs:140:18
+ |
+LL | 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)
+
+error: use as_ref() instead
+ --> $DIR/matches.rs:150:33
+ |
+LL | let borrowed: Option<&()> = match owned {
+ | _________________________________^
+LL | | None => None,
+LL | | Some(ref v) => Some(v),
+LL | | };
+ | |_____^ help: try this: `owned.as_ref()`
+ |
+ = note: `-D clippy::match-as-ref` implied by `-D warnings`
+
+error: use as_mut() instead
+ --> $DIR/matches.rs:156:39
+ |
+LL | let borrow_mut: Option<&mut ()> = match mut_owned {
+ | _______________________________________^
+LL | | None => None,
+LL | | Some(ref mut v) => Some(v),
+LL | | };
+ | |_____^ help: try this: `mut_owned.as_mut()`
+
+error: aborting due to 19 previous errors