@@ -88,7 +88,7 @@ LL | | .unwrap_or(None);
8888 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
8989
9090error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
91- --> $DIR/methods.rs:138 :13
91+ --> $DIR/methods.rs:141 :13
9292 |
9393LL | let _ = opt.map(|x| x + 1)
9494 | _____________^
@@ -100,7 +100,7 @@ LL | | .unwrap_or_else(|| 0); // should lint even though this cal
100100 = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
101101
102102error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
103- --> $DIR/methods.rs:142 :13
103+ --> $DIR/methods.rs:145 :13
104104 |
105105LL | let _ = opt.map(|x| {
106106 | _____________^
@@ -110,7 +110,7 @@ LL | | ).unwrap_or_else(|| 0);
110110 | |____________________________________^
111111
112112error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
113- --> $DIR/methods.rs:146 :13
113+ --> $DIR/methods.rs:149 :13
114114 |
115115LL | let _ = opt.map(|x| x + 1)
116116 | _____________^
@@ -120,15 +120,15 @@ LL | | );
120120 | |_________________^
121121
122122error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
123- --> $DIR/methods.rs:155 :13
123+ --> $DIR/methods.rs:158 :13
124124 |
125125LL | let _ = opt.map_or(None, |x| Some(x + 1));
126126 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
127127 |
128128 = note: `-D clippy::option-map-or-none` implied by `-D warnings`
129129
130130error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
131- --> $DIR/methods.rs:157 :13
131+ --> $DIR/methods.rs:160 :13
132132 |
133133LL | let _ = opt.map_or(None, |x| {
134134 | _____________^
@@ -144,7 +144,7 @@ LL | });
144144 |
145145
146146error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
147- --> $DIR/methods.rs:182 :13
147+ --> $DIR/methods.rs:185 :13
148148 |
149149LL | let _ = v.iter().filter(|&x| *x < 0).next();
150150 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -153,7 +153,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
153153 = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
154154
155155error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
156- --> $DIR/methods.rs:185 :13
156+ --> $DIR/methods.rs:188 :13
157157 |
158158LL | let _ = v.iter().filter(|&x| {
159159 | _____________^
@@ -163,7 +163,7 @@ LL | | ).next();
163163 | |___________________________^
164164
165165error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
166- --> $DIR/methods.rs:200 :13
166+ --> $DIR/methods.rs:203 :13
167167 |
168168LL | let _ = v.iter().find(|&x| *x < 0).is_some();
169169 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -172,7 +172,7 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
172172 = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
173173
174174error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
175- --> $DIR/methods.rs:203 :13
175+ --> $DIR/methods.rs:206 :13
176176 |
177177LL | let _ = v.iter().find(|&x| {
178178 | _____________^
@@ -182,15 +182,15 @@ LL | | ).is_some();
182182 | |______________________________^
183183
184184error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
185- --> $DIR/methods.rs:209 :13
185+ --> $DIR/methods.rs:212 :13
186186 |
187187LL | let _ = v.iter().position(|&x| x < 0).is_some();
188188 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189189 |
190190 = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
191191
192192error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
193- --> $DIR/methods.rs:212 :13
193+ --> $DIR/methods.rs:215 :13
194194 |
195195LL | let _ = v.iter().position(|&x| {
196196 | _____________^
@@ -200,15 +200,15 @@ LL | | ).is_some();
200200 | |______________________________^
201201
202202error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
203- --> $DIR/methods.rs:218 :13
203+ --> $DIR/methods.rs:221 :13
204204 |
205205LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
206206 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207207 |
208208 = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
209209
210210error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
211- --> $DIR/methods.rs:221 :13
211+ --> $DIR/methods.rs:224 :13
212212 |
213213LL | let _ = v.iter().rposition(|&x| {
214214 | _____________^
@@ -218,125 +218,125 @@ LL | | ).is_some();
218218 | |______________________________^
219219
220220error: use of `unwrap_or` followed by a function call
221- --> $DIR/methods.rs:256 :22
221+ --> $DIR/methods.rs:259 :22
222222 |
223223LL | with_constructor.unwrap_or(make());
224224 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
225225 |
226226 = note: `-D clippy::or-fun-call` implied by `-D warnings`
227227
228228error: use of `unwrap_or` followed by a call to `new`
229- --> $DIR/methods.rs:259 :5
229+ --> $DIR/methods.rs:262 :5
230230 |
231231LL | with_new.unwrap_or(Vec::new());
232232 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
233233
234234error: use of `unwrap_or` followed by a function call
235- --> $DIR/methods.rs:262 :21
235+ --> $DIR/methods.rs:265 :21
236236 |
237237LL | with_const_args.unwrap_or(Vec::with_capacity(12));
238238 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
239239
240240error: use of `unwrap_or` followed by a function call
241- --> $DIR/methods.rs:265 :14
241+ --> $DIR/methods.rs:268 :14
242242 |
243243LL | with_err.unwrap_or(make());
244244 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
245245
246246error: use of `unwrap_or` followed by a function call
247- --> $DIR/methods.rs:268 :19
247+ --> $DIR/methods.rs:271 :19
248248 |
249249LL | with_err_args.unwrap_or(Vec::with_capacity(12));
250250 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
251251
252252error: use of `unwrap_or` followed by a call to `default`
253- --> $DIR/methods.rs:271 :5
253+ --> $DIR/methods.rs:274 :5
254254 |
255255LL | with_default_trait.unwrap_or(Default::default());
256256 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
257257
258258error: use of `unwrap_or` followed by a call to `default`
259- --> $DIR/methods.rs:274 :5
259+ --> $DIR/methods.rs:277 :5
260260 |
261261LL | with_default_type.unwrap_or(u64::default());
262262 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
263263
264264error: use of `unwrap_or` followed by a function call
265- --> $DIR/methods.rs:277 :14
265+ --> $DIR/methods.rs:280 :14
266266 |
267267LL | with_vec.unwrap_or(vec![]);
268268 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])`
269269
270270error: use of `unwrap_or` followed by a function call
271- --> $DIR/methods.rs:282 :21
271+ --> $DIR/methods.rs:285 :21
272272 |
273273LL | without_default.unwrap_or(Foo::new());
274274 | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
275275
276276error: use of `or_insert` followed by a function call
277- --> $DIR/methods.rs:285 :19
277+ --> $DIR/methods.rs:288 :19
278278 |
279279LL | map.entry(42).or_insert(String::new());
280280 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
281281
282282error: use of `or_insert` followed by a function call
283- --> $DIR/methods.rs:288 :21
283+ --> $DIR/methods.rs:291 :21
284284 |
285285LL | btree.entry(42).or_insert(String::new());
286286 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
287287
288288error: use of `unwrap_or` followed by a function call
289- --> $DIR/methods.rs:291 :21
289+ --> $DIR/methods.rs:294 :21
290290 |
291291LL | let _ = stringy.unwrap_or("".to_owned());
292292 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
293293
294294error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
295- --> $DIR/methods.rs:302 :23
295+ --> $DIR/methods.rs:305 :23
296296 |
297297LL | let bad_vec = some_vec.iter().nth(3);
298298 | ^^^^^^^^^^^^^^^^^^^^^^
299299 |
300300 = note: `-D clippy::iter-nth` implied by `-D warnings`
301301
302302error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
303- --> $DIR/methods.rs:303 :26
303+ --> $DIR/methods.rs:306 :26
304304 |
305305LL | let bad_slice = &some_vec[..].iter().nth(3);
306306 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
307307
308308error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
309- --> $DIR/methods.rs:304 :31
309+ --> $DIR/methods.rs:307 :31
310310 |
311311LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
312312 | ^^^^^^^^^^^^^^^^^^^^^^^^^
313313
314314error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
315- --> $DIR/methods.rs:305 :29
315+ --> $DIR/methods.rs:308 :29
316316 |
317317LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
318318 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
319319
320320error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
321- --> $DIR/methods.rs:310 :23
321+ --> $DIR/methods.rs:313 :23
322322 |
323323LL | let bad_vec = some_vec.iter_mut().nth(3);
324324 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
325325
326326error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
327- --> $DIR/methods.rs:313 :26
327+ --> $DIR/methods.rs:316 :26
328328 |
329329LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
330330 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
331331
332332error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
333- --> $DIR/methods.rs:316 :29
333+ --> $DIR/methods.rs:319 :29
334334 |
335335LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
336336 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
337337
338338error: used unwrap() on an Option value. If you don't want to handle the None case gracefully, consider using expect() to provide a better panic message
339- --> $DIR/methods.rs:328 :13
339+ --> $DIR/methods.rs:331 :13
340340 |
341341LL | let _ = opt.unwrap();
342342 | ^^^^^^^^^^^^
0 commit comments