]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/matches.stderr
Better binding name on Err for note
[rust.git] / tests / ui / matches.stderr
index aebb166d3bcd41d8341732aab51031af1b892819..dd8014073df73c5f2b37e214d3c93795dc56519e 100644 (file)
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
-  --> $DIR/matches.rs:31:5
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:14:9
    |
-31 | /     match ExprNode::Butterflies {
-32 | |         ExprNode::ExprAddrOf => Some(&NODE),
-33 | |         _ => { let x = 5; None },
-34 | |     }
-   | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }`
+LL |         Err(_) => panic!("err"),
+   |         ^^^^^^
    |
-   = note: `-D clippy::single-match-else` implied by `-D warnings`
+   = 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: you don't need to add `&` to all patterns
-  --> $DIR/matches.rs:40:9
-   |
-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
-   |
-40 |         match *v {
-41 |             Some(v) => println!("{:?}", v),
-42 |             None => println!("none"),
+error: this `match` has identical arm bodies
+  --> $DIR/matches.rs:13:18
    |
-
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
-  --> $DIR/matches.rs:50:5
-   |
-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
-  --> $DIR/matches.rs:50:5
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
    |
-50 | /     match tup {
-51 | |         &(v, 1) => println!("{}", v),
-52 | |         _ => println!("none"),
-53 | |     }
-   | |_____^
-help: instead of prefixing all patterns with `&`, you can dereference the expression
+   = note: `-D clippy::match-same-arms` implied by `-D warnings`
+note: same as this
+  --> $DIR/matches.rs:12:18
    |
-50 |     match *tup {
-51 |         (v, 1) => println!("{}", v),
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:12:9
    |
+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: you don't need to add `&` to both the expression and the patterns
-  --> $DIR/matches.rs:56:5
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:20:9
    |
-56 | /     match &w {
-57 | |         &Some(v) => println!("{:?}", v),
-58 | |         &None => println!("none"),
-59 | |     }
-   | |_____^
-help: try
-   |
-56 |     match w {
-57 |         Some(v) => println!("{:?}", v),
-58 |         None => println!("none"),
+LL |         Err(_) => panic!(),
+   |         ^^^^^^
    |
+   = note: to remove this warning, match each error separately or use `unreachable!` macro
 
-error: you don't need to add `&` to all patterns
-  --> $DIR/matches.rs:67:5
+error: this `match` has identical arm bodies
+  --> $DIR/matches.rs:19:18
    |
-67 | /     if let &None = a {
-68 | |         println!("none");
-69 | |     }
-   | |_____^
-help: instead of prefixing all patterns with `&`, you can dereference the expression
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
    |
-67 |     if let None = *a {
-   |            ^^^^   ^^
-
-error: you don't need to add `&` to both the expression and the patterns
-  --> $DIR/matches.rs:72:5
+note: same as this
+  --> $DIR/matches.rs:18:18
    |
-72 | /     if let &None = &b {
-73 | |         println!("none");
-74 | |     }
-   | |_____^
-help: try
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:18:9
    |
-72 |     if let None = b {
-   |            ^^^^   ^
+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:83:9
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:26:9
    |
-83 |         Err(_) => panic!("err")
+LL |         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
+   = 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
+  --> $DIR/matches.rs:25:18
    |
-82 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
-   = note: `-D clippy::match-same-arms` implied by `-D warnings`
 note: same as this
-  --> $DIR/matches.rs:81:18
+  --> $DIR/matches.rs:24:18
    |
-81 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:81:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:24:9
    |
-81 |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
+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:89:9
+error: `Err(_e)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:34:9
    |
-89 |         Err(_) => {panic!()}
-   |         ^^^^^^
+LL |         Err(_e) => panic!(),
+   |         ^^^^^^^
    |
-   = note: to remove this warning, match each error separately or use unreachable macro
+   = note: to remove this warning, match each error separately or use `unreachable!` macro
 
 error: this `match` has identical arm bodies
-  --> $DIR/matches.rs:88:18
+  --> $DIR/matches.rs:33:18
    |
-88 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:87:18
+  --> $DIR/matches.rs:32:18
    |
-87 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:87:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:32:9
    |
-87 |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
+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:95:9
-   |
-95 |         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:94:18
+  --> $DIR/matches.rs:40:18
    |
-94 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:93:18
+  --> $DIR/matches.rs:39:18
    |
-93 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:93:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:39:9
    |
-93 |         Ok(3) => println!("ok"),
-   |                  ^^^^^^^^^^^^^^
+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:101:18
-    |
-101 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:47:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:100:18
-    |
-100 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:100:18
-    |
-100 |         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)
+  --> $DIR/matches.rs:46:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:46:9
+   |
+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:108:18
-    |
-108 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:54:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:107:18
-    |
-107 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:107:18
-    |
-107 |         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)
+  --> $DIR/matches.rs:53:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:53:9
+   |
+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:114:18
-    |
-114 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:60:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:113:18
-    |
-113 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:113:18
-    |
-113 |         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)
+  --> $DIR/matches.rs:59:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:59:9
+   |
+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:120:18
-    |
-120 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:66:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:119:18
-    |
-119 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:119:18
-    |
-119 |         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)
+  --> $DIR/matches.rs:65:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:65:9
+   |
+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:141:29
-    |
-141 |         (Ok(_), Some(x)) => println!("ok {}", x),
-    |                             ^^^^^^^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:89:29
+   |
+LL |         (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)
+  --> $DIR/matches.rs:88:29
+   |
+LL |         (Ok(x), Some(_)) => println!("ok {}", x),
+   |                             ^^^^^^^^^^^^^^^^^^^^
+help: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
+  --> $DIR/matches.rs:88:9
+   |
+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:156:18
-    |
-156 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:104:18
+   |
+LL |         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)
-
-error: use as_ref() instead
-   --> $DIR/matches.rs:163:33
-    |
-163 |       let borrowed: Option<&()> = match owned {
-    |  _________________________________^
-164 | |         None => None,
-165 | |         Some(ref v) => Some(v),
-166 | |     };
-    | |_____^ help: try this: `owned.as_ref()`
-    |
-    = note: `-D clippy::match-as-ref` implied by `-D warnings`
-
-error: use as_mut() instead
-   --> $DIR/matches.rs:169:39
-    |
-169 |       let borrow_mut: Option<&mut ()> = match mut_owned {
-    |  _______________________________________^
-170 | |         None => None,
-171 | |         Some(ref mut v) => Some(v),
-172 | |     };
-    | |_____^ help: try this: `mut_owned.as_mut()`
+  --> $DIR/matches.rs:103:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:103:9
+   |
+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: aborting due to 21 previous errors
+error: aborting due to 15 previous errors