]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_unwrap_or.stderr
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / manual_unwrap_or.stderr
1 error: this pattern reimplements `Option::unwrap_or`
2   --> $DIR/manual_unwrap_or.rs:7: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:13: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:19: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:26: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:36: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:86:5
62    |
63 LL | /     match Ok::<i32, &str>(1) {
64 LL | |         Ok(i) => i,
65 LL | |         Err(_) => 42,
66 LL | |     };
67    | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
68
69 error: this pattern reimplements `Result::unwrap_or`
70   --> $DIR/manual_unwrap_or.rs:93:5
71    |
72 LL | /     match a {
73 LL | |         Ok(i) => i,
74 LL | |         Err(_) => 42,
75 LL | |     };
76    | |_____^ help: replace with: `a.unwrap_or(42)`
77
78 error: this pattern reimplements `Result::unwrap_or`
79   --> $DIR/manual_unwrap_or.rs:99:5
80    |
81 LL | /     match Ok(1) as Result<i32, &str> {
82 LL | |         Ok(i) => i,
83 LL | |         Err(_) => 42,
84 LL | |     };
85    | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
86
87 error: this pattern reimplements `Option::unwrap_or`
88   --> $DIR/manual_unwrap_or.rs:112:5
89    |
90 LL | /     match s.method() {
91 LL | |         Some(i) => i,
92 LL | |         None => 42,
93 LL | |     };
94    | |_____^ help: replace with: `s.method().unwrap_or(42)`
95
96 error: this pattern reimplements `Result::unwrap_or`
97   --> $DIR/manual_unwrap_or.rs:118:5
98    |
99 LL | /     match Ok::<i32, &str>(1) {
100 LL | |         Err(_) => 42,
101 LL | |         Ok(i) => i,
102 LL | |     };
103    | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
104
105 error: this pattern reimplements `Result::unwrap_or`
106   --> $DIR/manual_unwrap_or.rs:124:5
107    |
108 LL | /     match Ok::<i32, &str>(1) {
109 LL | |         Ok(i) => i,
110 LL | |         Err(_) => 1 + 42,
111 LL | |     };
112    | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(1 + 42)`
113
114 error: this pattern reimplements `Result::unwrap_or`
115   --> $DIR/manual_unwrap_or.rs:131:5
116    |
117 LL | /     match Ok::<i32, &str>(1) {
118 LL | |         Ok(i) => i,
119 LL | |         Err(_) => {
120 LL | |             42 + 42
121 ...  |
122 LL | |         }
123 LL | |     };
124    | |_____^
125    |
126 help: replace with
127    |
128 LL ~     Ok::<i32, &str>(1).unwrap_or({
129 LL +         42 + 42
130 LL +             + 42 + 42 + 42
131 LL +             + 42 + 42 + 42
132 LL ~     });
133    |
134
135 error: this pattern reimplements `Result::unwrap_or`
136   --> $DIR/manual_unwrap_or.rs:141:5
137    |
138 LL | /     match Ok::<&str, &str>("Bob") {
139 LL | |         Ok(i) => i,
140 LL | |         Err(_) => "Alice",
141 LL | |     };
142    | |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")`
143
144 error: this pattern reimplements `Option::unwrap_or`
145   --> $DIR/manual_unwrap_or.rs:201:17
146    |
147 LL |           let _ = match some_macro!() {
148    |  _________________^
149 LL | |             Some(val) => val,
150 LL | |             None => 0,
151 LL | |         };
152    | |_________^ help: replace with: `some_macro!().unwrap_or(0)`
153
154 error: aborting due to 14 previous errors
155