]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_unwrap_or.stderr
manual_unwrap_or / use consts::constant_simple helper
[rust.git] / tests / ui / manual_unwrap_or.stderr
1 error: this pattern reimplements `Option::unwrap_or`
2   --> $DIR/manual_unwrap_or.rs:6:5
3    |
4 LL | /     match Some(1) {
5 LL | |         Some(i) => i,
6 LL | |         None => 42,
7 LL | |     };
8    | |_____^ help: replace with: `Some(1).unwrap_or(42)`
9    |
10    = note: `-D clippy::manual-unwrap-or` implied by `-D warnings`
11
12 error: this pattern reimplements `Option::unwrap_or`
13   --> $DIR/manual_unwrap_or.rs:12:5
14    |
15 LL | /     match Some(1) {
16 LL | |         None => 42,
17 LL | |         Some(i) => i,
18 LL | |     };
19    | |_____^ help: replace with: `Some(1).unwrap_or(42)`
20
21 error: this pattern reimplements `Option::unwrap_or`
22   --> $DIR/manual_unwrap_or.rs:18:5
23    |
24 LL | /     match Some(1) {
25 LL | |         Some(i) => i,
26 LL | |         None => 1 + 42,
27 LL | |     };
28    | |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)`
29
30 error: this pattern reimplements `Option::unwrap_or_else`
31   --> $DIR/manual_unwrap_or.rs:24:5
32    |
33 LL | /     match Some(1) {
34 LL | |         Some(i) => i,
35 LL | |         None => {
36 LL | |             let a = 1 + 42;
37 ...  |
38 LL | |         },
39 LL | |     };
40    | |_____^
41    |
42 help: replace with
43    |
44 LL |     Some(1).unwrap_or_else(|| {
45 LL |         let a = 1 + 42;
46 LL |         let b = a + 42;
47 LL |         b + 42
48 LL |     });
49    |
50
51 error: this pattern reimplements `Option::unwrap_or`
52   --> $DIR/manual_unwrap_or.rs:34:5
53    |
54 LL | /     match Some("Bob") {
55 LL | |         Some(i) => i,
56 LL | |         None => "Alice",
57 LL | |     };
58    | |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
59
60 error: aborting due to 5 previous errors
61