]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr
Auto merge of #78458 - Dylan-DPC:rollup-tan044s, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / unnecessary_lazy_eval.stderr
1 error: unnecessary closure used to substitute value for `Option::None`
2   --> $DIR/unnecessary_lazy_eval.rs:35:13
3    |
4 LL |     let _ = opt.unwrap_or_else(|| 2);
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(2)`
6    |
7    = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
8
9 error: unnecessary closure used to substitute value for `Option::None`
10   --> $DIR/unnecessary_lazy_eval.rs:36:13
11    |
12 LL |     let _ = opt.unwrap_or_else(|| astronomers_pi);
13    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(astronomers_pi)`
14
15 error: unnecessary closure used to substitute value for `Option::None`
16   --> $DIR/unnecessary_lazy_eval.rs:37:13
17    |
18 LL |     let _ = opt.unwrap_or_else(|| ext_str.some_field);
19    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(ext_str.some_field)`
20
21 error: unnecessary closure used to substitute value for `Option::None`
22   --> $DIR/unnecessary_lazy_eval.rs:39:13
23    |
24 LL |     let _ = opt.and_then(|_| ext_opt);
25    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `opt.and(ext_opt)`
26
27 error: unnecessary closure used to substitute value for `Option::None`
28   --> $DIR/unnecessary_lazy_eval.rs:40:13
29    |
30 LL |     let _ = opt.or_else(|| ext_opt);
31    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(ext_opt)`
32
33 error: unnecessary closure used to substitute value for `Option::None`
34   --> $DIR/unnecessary_lazy_eval.rs:41:13
35    |
36 LL |     let _ = opt.or_else(|| None);
37    |             ^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(None)`
38
39 error: unnecessary closure used to substitute value for `Option::None`
40   --> $DIR/unnecessary_lazy_eval.rs:42:13
41    |
42 LL |     let _ = opt.get_or_insert_with(|| 2);
43    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `opt.get_or_insert(2)`
44
45 error: unnecessary closure used to substitute value for `Option::None`
46   --> $DIR/unnecessary_lazy_eval.rs:43:13
47    |
48 LL |     let _ = opt.ok_or_else(|| 2);
49    |             ^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `opt.ok_or(2)`
50
51 error: unnecessary closure used to substitute value for `Option::None`
52   --> $DIR/unnecessary_lazy_eval.rs:44:13
53    |
54 LL |     let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2)));
55    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `nested_tuple_opt.unwrap_or(Some((1, 2)))`
56
57 error: unnecessary closure used to substitute value for `Option::None`
58   --> $DIR/unnecessary_lazy_eval.rs:47:13
59    |
60 LL |     let _ = Some(10).unwrap_or_else(|| 2);
61    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Some(10).unwrap_or(2)`
62
63 error: unnecessary closure used to substitute value for `Option::None`
64   --> $DIR/unnecessary_lazy_eval.rs:48:13
65    |
66 LL |     let _ = Some(10).and_then(|_| ext_opt);
67    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `Some(10).and(ext_opt)`
68
69 error: unnecessary closure used to substitute value for `Option::None`
70   --> $DIR/unnecessary_lazy_eval.rs:49:28
71    |
72 LL |     let _: Option<usize> = None.or_else(|| ext_opt);
73    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(ext_opt)`
74
75 error: unnecessary closure used to substitute value for `Option::None`
76   --> $DIR/unnecessary_lazy_eval.rs:50:13
77    |
78 LL |     let _ = None.get_or_insert_with(|| 2);
79    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `None.get_or_insert(2)`
80
81 error: unnecessary closure used to substitute value for `Option::None`
82   --> $DIR/unnecessary_lazy_eval.rs:51:35
83    |
84 LL |     let _: Result<usize, usize> = None.ok_or_else(|| 2);
85    |                                   ^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `None.ok_or(2)`
86
87 error: unnecessary closure used to substitute value for `Option::None`
88   --> $DIR/unnecessary_lazy_eval.rs:52:28
89    |
90 LL |     let _: Option<usize> = None.or_else(|| None);
91    |                            ^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(None)`
92
93 error: unnecessary closure used to substitute value for `Option::None`
94   --> $DIR/unnecessary_lazy_eval.rs:55:13
95    |
96 LL |     let _ = deep.0.unwrap_or_else(|| 2);
97    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `deep.0.unwrap_or(2)`
98
99 error: unnecessary closure used to substitute value for `Option::None`
100   --> $DIR/unnecessary_lazy_eval.rs:56:13
101    |
102 LL |     let _ = deep.0.and_then(|_| ext_opt);
103    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `deep.0.and(ext_opt)`
104
105 error: unnecessary closure used to substitute value for `Option::None`
106   --> $DIR/unnecessary_lazy_eval.rs:57:13
107    |
108 LL |     let _ = deep.0.or_else(|| None);
109    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `deep.0.or(None)`
110
111 error: unnecessary closure used to substitute value for `Option::None`
112   --> $DIR/unnecessary_lazy_eval.rs:58:13
113    |
114 LL |     let _ = deep.0.get_or_insert_with(|| 2);
115    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `deep.0.get_or_insert(2)`
116
117 error: unnecessary closure used to substitute value for `Option::None`
118   --> $DIR/unnecessary_lazy_eval.rs:59:13
119    |
120 LL |     let _ = deep.0.ok_or_else(|| 2);
121    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `deep.0.ok_or(2)`
122
123 error: unnecessary closure used to substitute value for `Option::None`
124   --> $DIR/unnecessary_lazy_eval.rs:79:28
125    |
126 LL |     let _: Option<usize> = None.or_else(|| Some(3));
127    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(Some(3))`
128
129 error: unnecessary closure used to substitute value for `Option::None`
130   --> $DIR/unnecessary_lazy_eval.rs:80:13
131    |
132 LL |     let _ = deep.0.or_else(|| Some(3));
133    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `deep.0.or(Some(3))`
134
135 error: unnecessary closure used to substitute value for `Option::None`
136   --> $DIR/unnecessary_lazy_eval.rs:81:13
137    |
138 LL |     let _ = opt.or_else(|| Some(3));
139    |             ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(Some(3))`
140
141 error: unnecessary closure used to substitute value for `Result::Err`
142   --> $DIR/unnecessary_lazy_eval.rs:87:13
143    |
144 LL |     let _ = res2.unwrap_or_else(|_| 2);
145    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(2)`
146
147 error: unnecessary closure used to substitute value for `Result::Err`
148   --> $DIR/unnecessary_lazy_eval.rs:88:13
149    |
150 LL |     let _ = res2.unwrap_or_else(|_| astronomers_pi);
151    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(astronomers_pi)`
152
153 error: unnecessary closure used to substitute value for `Result::Err`
154   --> $DIR/unnecessary_lazy_eval.rs:89:13
155    |
156 LL |     let _ = res2.unwrap_or_else(|_| ext_str.some_field);
157    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(ext_str.some_field)`
158
159 error: unnecessary closure used to substitute value for `Result::Err`
160   --> $DIR/unnecessary_lazy_eval.rs:111:35
161    |
162 LL |     let _: Result<usize, usize> = res.and_then(|_| Err(2));
163    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(2))`
164
165 error: unnecessary closure used to substitute value for `Result::Err`
166   --> $DIR/unnecessary_lazy_eval.rs:112:35
167    |
168 LL |     let _: Result<usize, usize> = res.and_then(|_| Err(astronomers_pi));
169    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(astronomers_pi))`
170
171 error: unnecessary closure used to substitute value for `Result::Err`
172   --> $DIR/unnecessary_lazy_eval.rs:113:35
173    |
174 LL |     let _: Result<usize, usize> = res.and_then(|_| Err(ext_str.some_field));
175    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(ext_str.some_field))`
176
177 error: unnecessary closure used to substitute value for `Result::Err`
178   --> $DIR/unnecessary_lazy_eval.rs:115:35
179    |
180 LL |     let _: Result<usize, usize> = res.or_else(|_| Ok(2));
181    |                                   ^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(2))`
182
183 error: unnecessary closure used to substitute value for `Result::Err`
184   --> $DIR/unnecessary_lazy_eval.rs:116:35
185    |
186 LL |     let _: Result<usize, usize> = res.or_else(|_| Ok(astronomers_pi));
187    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(astronomers_pi))`
188
189 error: unnecessary closure used to substitute value for `Result::Err`
190   --> $DIR/unnecessary_lazy_eval.rs:117:35
191    |
192 LL |     let _: Result<usize, usize> = res.or_else(|_| Ok(ext_str.some_field));
193    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(ext_str.some_field))`
194
195 error: aborting due to 32 previous errors
196