]> 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 3ed70168c6eb0a90c249f774e354b7c46b3f22a7..dd8014073df73c5f2b37e214d3c93795dc56519e 100644 (file)
-error: you don't need to add `&` to all patterns
-  --> $DIR/matches.rs:20:9
-   |
-20 | /         match v {
-21 | |             &Some(v) => println!("{:?}", v),
-22 | |             &None => println!("none"),
-23 | |         }
-   | |_________^
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:14:9
    |
-   = note: `-D clippy::match-ref-pats` implied by `-D warnings`
-help: instead of prefixing all patterns with `&`, you can dereference the expression
-   |
-20 |         match *v {
-21 |             Some(v) => println!("{:?}", v),
-22 |             None => println!("none"),
+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: you don't need to add `&` to all patterns
-  --> $DIR/matches.rs:31:5
+error: this `match` has identical arm bodies
+  --> $DIR/matches.rs:13:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
    |
-31 | /     match tup {
-32 | |         &(v, 1) => println!("{}", v),
-33 | |         _ => println!("none"),
-34 | |     }
-   | |_____^
-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
    |
-31 |     match *tup {
-32 |         (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:37:5
-   |
-37 | /     match &w {
-38 | |         &Some(v) => println!("{:?}", v),
-39 | |         &None => println!("none"),
-40 | |     }
-   | |_____^
-help: try
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:20:9
    |
-37 |     match w {
-38 |         Some(v) => println!("{:?}", v),
-39 |         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:48:5
+error: this `match` has identical arm bodies
+  --> $DIR/matches.rs:19:18
    |
-48 | /     if let &None = a {
-49 | |         println!("none");
-50 | |     }
-   | |_____^
-help: instead of prefixing all patterns with `&`, you can dereference the expression
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
    |
-48 |     if let None = *a {
-   |            ^^^^   ^^
-
-error: you don't need to add `&` to both the expression and the patterns
-  --> $DIR/matches.rs:53:5
+note: same as this
+  --> $DIR/matches.rs:18:18
    |
-53 | /     if let &None = &b {
-54 | |         println!("none");
-55 | |     }
-   | |_____^
-help: try
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:18:9
    |
-53 |     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:64:9
+error: `Err(_)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:26:9
    |
-64 |         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:63:18
+  --> $DIR/matches.rs:25:18
    |
-63 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
-   = note: `-D clippy::match-same-arms` implied by `-D warnings`
 note: same as this
-  --> $DIR/matches.rs:62:18
+  --> $DIR/matches.rs:24:18
    |
-62 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:62:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:24:9
    |
-62 |         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:70:9
+error: `Err(_e)` will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:34:9
    |
-70 |         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:69:18
+  --> $DIR/matches.rs:33:18
    |
-69 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:68:18
+  --> $DIR/matches.rs:32:18
    |
-68 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:68:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:32:9
    |
-68 |         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:76:9
-   |
-76 |         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
+  --> $DIR/matches.rs:40:18
    |
-75 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:74:18
+  --> $DIR/matches.rs:39:18
    |
-74 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:74:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:39:9
    |
-74 |         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:84:18
+  --> $DIR/matches.rs:47:18
    |
-84 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:83:18
+  --> $DIR/matches.rs:46:18
    |
-83 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:83:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:46:9
    |
-83 |         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:91:18
+  --> $DIR/matches.rs:54:18
    |
-91 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:90:18
+  --> $DIR/matches.rs:53:18
    |
-90 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:90:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:53:9
    |
-90 |         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:97:18
+  --> $DIR/matches.rs:60:18
    |
-97 |         Ok(_) => println!("ok"),
+LL |         Ok(_) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
    |
 note: same as this
-  --> $DIR/matches.rs:96:18
+  --> $DIR/matches.rs:59:18
    |
-96 |         Ok(3) => println!("ok"),
+LL |         Ok(3) => println!("ok"),
    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-  --> $DIR/matches.rs:96:18
+help: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:59:9
    |
-96 |         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:103:18
-    |
-103 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:66:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:102:18
-    |
-102 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:102:18
-    |
-102 |         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:126:29
-    |
-126 |         (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:125:29
-    |
-125 |         (Ok(x), Some(_)) => println!("ok {}", x),
-    |                             ^^^^^^^^^^^^^^^^^^^^
-note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))`
-   --> $DIR/matches.rs:125:29
-    |
-125 |         (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:141:18
-    |
-141 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:104:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:140:18
-    |
-140 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:140:18
-    |
-140 |         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
-    |
-150 |       let borrowed: Option<&()> = match owned {
-    |  _________________________________^
-151 | |         None => None,
-152 | |         Some(ref v) => Some(v),
-153 | |     };
-    | |_____^ 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
-    |
-156 |       let borrow_mut: Option<&mut ()> = match mut_owned {
-    |  _______________________________________^
-157 | |         None => None,
-158 | |         Some(ref mut v) => Some(v),
-159 | |     };
-    | |_____^ 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 19 previous errors
+error: aborting due to 15 previous errors