]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_unwrap_or.stderr
manual_unwrap_or / support Result::unwrap_or
[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`
31   --> $DIR/manual_unwrap_or.rs:25:5
32    |
33 LL | /     match Some(1) {
34 LL | |         Some(i) => i,
35 LL | |         None => {
36 LL | |             42 + 42
37 ...  |
38 LL | |         }
39 LL | |     };
40    | |_____^
41    |
42 help: replace with
43    |
44 LL |     Some(1).unwrap_or({
45 LL |         42 + 42
46 LL |             + 42 + 42 + 42
47 LL |             + 42 + 42 + 42
48 LL |     });
49    |
50
51 error: this pattern reimplements `Option::unwrap_or`
52   --> $DIR/manual_unwrap_or.rs:35: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: this pattern reimplements `Result::unwrap_or`
61   --> $DIR/manual_unwrap_or.rs:85:5
62    |
63 LL | /     match Ok(1) as Result<i32, &str> {
64 LL | |         Ok(i) => i,
65 LL | |         Err(_) => 42,
66 LL | |     };
67    | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
68
69 error: this pattern reimplements `Result::unwrap_or`
70   --> $DIR/manual_unwrap_or.rs:91:5
71    |
72 LL | /     match Ok(1) as Result<i32, &str> {
73 LL | |         Err(_) => 42,
74 LL | |         Ok(i) => i,
75 LL | |     };
76    | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
77
78 error: this pattern reimplements `Result::unwrap_or`
79   --> $DIR/manual_unwrap_or.rs:97:5
80    |
81 LL | /     match Ok(1) as Result<i32, &str> {
82 LL | |         Ok(i) => i,
83 LL | |         Err(_) => 1 + 42,
84 LL | |     };
85    | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(1 + 42)`
86
87 error: this pattern reimplements `Result::unwrap_or`
88   --> $DIR/manual_unwrap_or.rs:104:5
89    |
90 LL | /     match Ok(1) as Result<i32, &str> {
91 LL | |         Ok(i) => i,
92 LL | |         Err(_) => {
93 LL | |             42 + 42
94 ...  |
95 LL | |         }
96 LL | |     };
97    | |_____^
98    |
99 help: replace with
100    |
101 LL |     (Ok(1) as Result<i32, &str>).unwrap_or({
102 LL |         42 + 42
103 LL |             + 42 + 42 + 42
104 LL |             + 42 + 42 + 42
105 LL |     });
106    |
107
108 error: this pattern reimplements `Result::unwrap_or`
109   --> $DIR/manual_unwrap_or.rs:114:5
110    |
111 LL | /     match Ok("Bob") as Result<&str, &str> {
112 LL | |         Ok(i) => i,
113 LL | |         Err(_) => "Alice",
114 LL | |     };
115    | |_____^ help: replace with: `(Ok("Bob") as Result<&str, &str>).unwrap_or("Alice")`
116
117 error: aborting due to 10 previous errors
118