]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/matches.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / matches.stderr
index 61c13056ccadebd625e7c612ac9c282a6e3b67dc..06ba6224855a514f860a3278c6d3b0ad1bfd50d3 100644 (file)
-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 | |     }
-   | |_____^ 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 don't need to add `&` to all patterns
-  --> $DIR/matches.rs:30:9
+  --> $DIR/matches.rs:20:9
    |
-30 | /         match v {
-31 | |             &Some(v) => println!("{:?}", v),
-32 | |             &None => println!("none"),
-33 | |         }
+LL | /         match v {
+LL | |             &Some(v) => println!("{:?}", v),
+LL | |             &None => println!("none"),
+LL | |         }
    | |_________^
    |
-   = note: `-D match-ref-pats` implied by `-D warnings`
+   = note: `-D clippy::match-ref-pats` implied by `-D warnings`
 help: instead of prefixing all patterns with `&`, you can dereference the expression
    |
-30 |         match *v {
-31 |             Some(v) => println!("{:?}", v),
-32 |             None => println!("none"),
+LL |         match *v {
+LL |             Some(v) => println!("{:?}", v),
+LL |             None => println!("none"),
    |
 
-error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
-  --> $DIR/matches.rs:40:5
-   |
-40 | /     match tup {
-41 | |         &(v, 1) => println!("{}", v),
-42 | |         _ => println!("none"),
-43 | |     }
-   | |_____^ help: try this: `if let &(v, 1) = tup { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; } else { $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ; }`
-
 error: you don't need to add `&` to all patterns
-  --> $DIR/matches.rs:40:5
+  --> $DIR/matches.rs:31:5
    |
-40 | /     match tup {
-41 | |         &(v, 1) => println!("{}", v),
-42 | |         _ => println!("none"),
-43 | |     }
+LL | /     match tup {
+LL | |         &(v, 1) => println!("{}", v),
+LL | |         _ => println!("none"),
+LL | |     }
    | |_____^
 help: instead of prefixing all patterns with `&`, you can dereference the expression
    |
-40 |     match *tup {
-41 |         (v, 1) => println!("{}", v),
+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:46:5
+  --> $DIR/matches.rs:37:5
    |
-46 | /     match &w {
-47 | |         &Some(v) => println!("{:?}", v),
-48 | |         &None => println!("none"),
-49 | |     }
+LL | /     match &w {
+LL | |         &Some(v) => println!("{:?}", v),
+LL | |         &None => println!("none"),
+LL | |     }
    | |_____^
 help: try
    |
-46 |     match w {
-47 |         Some(v) => println!("{:?}", v),
-48 |         None => println!("none"),
+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:57:5
+  --> $DIR/matches.rs:48:5
    |
-57 | /     if let &None = a {
-58 | |         println!("none");
-59 | |     }
+LL | /     if let &None = a {
+LL | |         println!("none");
+LL | |     }
    | |_____^
 help: instead of prefixing all patterns with `&`, you can dereference the expression
    |
-57 |     if let None = *a {
+LL |     if let None = *a {
    |            ^^^^   ^^
 
 error: you don't need to add `&` to both the expression and the patterns
-  --> $DIR/matches.rs:62:5
+  --> $DIR/matches.rs:53:5
    |
-62 | /     if let &None = &b {
-63 | |         println!("none");
-64 | |     }
+LL | /     if let &None = &b {
+LL | |         println!("none");
+LL | |     }
    | |_____^
 help: try
    |
-62 |     if let None = b {
+LL |     if let None = b {
    |            ^^^^   ^
 
-error: some ranges overlap
-  --> $DIR/matches.rs:71:9
-   |
-71 |         0 ... 10 => println!("0 ... 10"),
-   |         ^^^^^^^^
+error: Err(_) will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:64:9
    |
-   = note: `-D match-overlapping-arm` implied by `-D warnings`
-note: overlaps with this
-  --> $DIR/matches.rs:72:9
+LL |         Err(_) => panic!("err"),
+   |         ^^^^^^
    |
-72 |         0 ... 11 => println!("0 ... 11"),
-   |         ^^^^^^^^
+   = 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: some ranges overlap
-  --> $DIR/matches.rs:77:9
-   |
-77 |         0 ... 5 => println!("0 ... 5"),
-   |         ^^^^^^^
-   |
-note: overlaps with this
-  --> $DIR/matches.rs:79:9
+error: this `match` has identical arm bodies
+  --> $DIR/matches.rs:63:18
    |
-79 |         FOO ... 11 => println!("0 ... 11"),
-   |         ^^^^^^^^^^
-
-error: some ranges overlap
-  --> $DIR/matches.rs:85:9
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
    |
-85 |         0 ... 5 => println!("0 ... 5"),
-   |         ^^^^^^^
+   = note: `-D clippy::match-same-arms` implied by `-D warnings`
+note: same as this
+  --> $DIR/matches.rs:62:18
    |
-note: overlaps with this
-  --> $DIR/matches.rs:84:9
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+note: consider refactoring into `Ok(3) | Ok(_)`
+  --> $DIR/matches.rs:62:18
    |
-84 |         2 => println!("2"),
-   |         ^
+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: some ranges overlap
-  --> $DIR/matches.rs:91:9
-   |
-91 |         0 ... 2 => println!("0 ... 2"),
-   |         ^^^^^^^
+error: Err(_) will match all errors, maybe not a good idea
+  --> $DIR/matches.rs:70:9
    |
-note: overlaps with this
-  --> $DIR/matches.rs:90:9
+LL |         Err(_) => panic!(),
+   |         ^^^^^^
    |
-90 |         2 => println!("2"),
-   |         ^
-
-error: some ranges overlap
-   --> $DIR/matches.rs:114:9
-    |
-114 |         0 .. 11 => println!("0 .. 11"),
-    |         ^^^^^^^
-    |
-note: overlaps with this
-   --> $DIR/matches.rs:115:9
-    |
-115 |         0 ... 11 => println!("0 ... 11"),
-    |         ^^^^^^^^
-
-error: Err(_) will match all errors, maybe not a good idea
-   --> $DIR/matches.rs:132:9
-    |
-132 |         Err(_) => panic!("err")
-    |         ^^^^^^
-    |
-    = note: `-D 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:131:18
-    |
-131 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
-    = note: `-D match-same-arms` implied by `-D warnings`
-note: same as this
-   --> $DIR/matches.rs:130:18
-    |
-130 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:130:18
-    |
-130 |         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:138:9
-    |
-138 |         Err(_) => {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:137:18
-    |
-137 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:69:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:136:18
-    |
-136 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:68:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:136:18
-    |
-136 |         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: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:144:9
-    |
-144 |         Err(_) => {panic!();}
-    |         ^^^^^^
-    |
-    = note: to remove this warning, match each error separately 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:143:18
-    |
-143 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:75:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:142:18
-    |
-142 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:74:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:142:18
-    |
-142 |         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: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:150:18
-    |
-150 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:84:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:149:18
-    |
-149 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:83:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:149:18
-    |
-149 |         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: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:157:18
-    |
-157 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:91:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:156:18
-    |
-156 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:90:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:156:18
-    |
-156 |         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: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:163:18
-    |
-163 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:97:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:162:18
-    |
-162 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:96:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:162:18
-    |
-162 |         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: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:169:18
-    |
-169 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:103:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:168:18
-    |
-168 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:102:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:168:18
-    |
-168 |         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: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:190:29
-    |
-190 |         (Ok(_), Some(x)) => println!("ok {}", x),
-    |                             ^^^^^^^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:126:29
+   |
+LL |         (Ok(_), Some(x)) => println!("ok {}", x),
+   |                             ^^^^^^^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:189:29
-    |
-189 |         (Ok(x), Some(_)) => println!("ok {}", x),
-    |                             ^^^^^^^^^^^^^^^^^^^^
+  --> $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:189:29
-    |
-189 |         (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: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:205:18
-    |
-205 |         Ok(_) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
-    |
+  --> $DIR/matches.rs:141:18
+   |
+LL |         Ok(_) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
+   |
 note: same as this
-   --> $DIR/matches.rs:204:18
-    |
-204 |         Ok(3) => println!("ok"),
-    |                  ^^^^^^^^^^^^^^
+  --> $DIR/matches.rs:140:18
+   |
+LL |         Ok(3) => println!("ok"),
+   |                  ^^^^^^^^^^^^^^
 note: consider refactoring into `Ok(3) | Ok(_)`
-   --> $DIR/matches.rs:204:18
-    |
-204 |         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: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:212:33
-    |
-212 |       let borrowed: Option<&()> = match owned {
-    |  _________________________________^
-213 | |         None => None,
-214 | |         Some(ref v) => Some(v),
-215 | |     };
-    | |_____^ help: try this: `owned.as_ref()`
-    |
-    = note: `-D match-as-ref` implied by `-D warnings`
+  --> $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:218:39
-    |
-218 |       let borrow_mut: Option<&mut ()> = match mut_owned {
-    |  _______________________________________^
-219 | |         None => None,
-220 | |         Some(ref mut v) => Some(v),
-221 | |     };
-    | |_____^ help: try this: `mut_owned.as_mut()`
+  --> $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 26 previous errors
+error: aborting due to 19 previous errors