@@ -90,7 +90,7 @@ LL | | .unwrap_or(None);
9090 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
9191
9292error: 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
93- --> $DIR/methods.rs:184 :13
93+ --> $DIR/methods.rs:187 :13
9494 |
9595LL | let _ = opt.map(|x| x + 1)
9696 | _____________^
@@ -102,7 +102,7 @@ LL | | .unwrap_or_else(|| 0); // should lint even though this cal
102102 = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
103103
104104error: 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
105- --> $DIR/methods.rs:188 :13
105+ --> $DIR/methods.rs:191 :13
106106 |
107107LL | let _ = opt.map(|x| {
108108 | _____________^
@@ -112,7 +112,7 @@ LL | | ).unwrap_or_else(|| 0);
112112 | |____________________________________^
113113
114114error: 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
115- --> $DIR/methods.rs:192 :13
115+ --> $DIR/methods.rs:195 :13
116116 |
117117LL | let _ = opt.map(|x| x + 1)
118118 | _____________^
@@ -122,15 +122,15 @@ LL | | );
122122 | |_________________^
123123
124124error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
125- --> $DIR/methods.rs:201 :13
125+ --> $DIR/methods.rs:204 :13
126126 |
127127LL | let _ = opt.map_or(None, |x| Some(x + 1));
128128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
129129 |
130130 = note: `-D clippy::option-map-or-none` implied by `-D warnings`
131131
132132error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
133- --> $DIR/methods.rs:203 :13
133+ --> $DIR/methods.rs:206 :13
134134 |
135135LL | let _ = opt.map_or(None, |x| {
136136 | _____________^
@@ -146,7 +146,7 @@ LL | });
146146 |
147147
148148error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
149- --> $DIR/methods.rs:229 :13
149+ --> $DIR/methods.rs:232 :13
150150 |
151151LL | let _ = v.iter().filter(|&x| *x < 0).next();
152152 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -155,7 +155,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
155155 = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
156156
157157error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
158- --> $DIR/methods.rs:232 :13
158+ --> $DIR/methods.rs:235 :13
159159 |
160160LL | let _ = v.iter().filter(|&x| {
161161 | _____________^
@@ -165,7 +165,7 @@ LL | | ).next();
165165 | |___________________________^
166166
167167error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
168- --> $DIR/methods.rs:248 :13
168+ --> $DIR/methods.rs:251 :13
169169 |
170170LL | let _ = v.iter().find(|&x| *x < 0).is_some();
171171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +174,7 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
174174 = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
175175
176176error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
177- --> $DIR/methods.rs:251 :13
177+ --> $DIR/methods.rs:254 :13
178178 |
179179LL | let _ = v.iter().find(|&x| {
180180 | _____________^
@@ -184,15 +184,15 @@ LL | | ).is_some();
184184 | |______________________________^
185185
186186error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
187- --> $DIR/methods.rs:257 :13
187+ --> $DIR/methods.rs:260 :13
188188 |
189189LL | let _ = v.iter().position(|&x| x < 0).is_some();
190190 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191191 |
192192 = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
193193
194194error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
195- --> $DIR/methods.rs:260 :13
195+ --> $DIR/methods.rs:263 :13
196196 |
197197LL | let _ = v.iter().position(|&x| {
198198 | _____________^
@@ -202,15 +202,15 @@ LL | | ).is_some();
202202 | |______________________________^
203203
204204error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
205- --> $DIR/methods.rs:266 :13
205+ --> $DIR/methods.rs:269 :13
206206 |
207207LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
208208 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209209 |
210210 = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
211211
212212error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
213- --> $DIR/methods.rs:269 :13
213+ --> $DIR/methods.rs:272 :13
214214 |
215215LL | let _ = v.iter().rposition(|&x| {
216216 | _____________^
@@ -220,125 +220,125 @@ LL | | ).is_some();
220220 | |______________________________^
221221
222222error: use of `unwrap_or` followed by a function call
223- --> $DIR/methods.rs:306 :22
223+ --> $DIR/methods.rs:309 :22
224224 |
225225LL | with_constructor.unwrap_or(make());
226226 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
227227 |
228228 = note: `-D clippy::or-fun-call` implied by `-D warnings`
229229
230230error: use of `unwrap_or` followed by a call to `new`
231- --> $DIR/methods.rs:309 :5
231+ --> $DIR/methods.rs:312 :5
232232 |
233233LL | with_new.unwrap_or(Vec::new());
234234 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
235235
236236error: use of `unwrap_or` followed by a function call
237- --> $DIR/methods.rs:312 :21
237+ --> $DIR/methods.rs:315 :21
238238 |
239239LL | with_const_args.unwrap_or(Vec::with_capacity(12));
240240 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
241241
242242error: use of `unwrap_or` followed by a function call
243- --> $DIR/methods.rs:315 :14
243+ --> $DIR/methods.rs:318 :14
244244 |
245245LL | with_err.unwrap_or(make());
246246 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
247247
248248error: use of `unwrap_or` followed by a function call
249- --> $DIR/methods.rs:318 :19
249+ --> $DIR/methods.rs:321 :19
250250 |
251251LL | with_err_args.unwrap_or(Vec::with_capacity(12));
252252 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
253253
254254error: use of `unwrap_or` followed by a call to `default`
255- --> $DIR/methods.rs:321 :5
255+ --> $DIR/methods.rs:324 :5
256256 |
257257LL | with_default_trait.unwrap_or(Default::default());
258258 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
259259
260260error: use of `unwrap_or` followed by a call to `default`
261- --> $DIR/methods.rs:324 :5
261+ --> $DIR/methods.rs:327 :5
262262 |
263263LL | with_default_type.unwrap_or(u64::default());
264264 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
265265
266266error: use of `unwrap_or` followed by a function call
267- --> $DIR/methods.rs:327 :14
267+ --> $DIR/methods.rs:330 :14
268268 |
269269LL | with_vec.unwrap_or(vec![]);
270270 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])`
271271
272272error: use of `unwrap_or` followed by a function call
273- --> $DIR/methods.rs:332 :21
273+ --> $DIR/methods.rs:335 :21
274274 |
275275LL | without_default.unwrap_or(Foo::new());
276276 | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
277277
278278error: use of `or_insert` followed by a function call
279- --> $DIR/methods.rs:335 :19
279+ --> $DIR/methods.rs:338 :19
280280 |
281281LL | map.entry(42).or_insert(String::new());
282282 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
283283
284284error: use of `or_insert` followed by a function call
285- --> $DIR/methods.rs:338 :21
285+ --> $DIR/methods.rs:341 :21
286286 |
287287LL | btree.entry(42).or_insert(String::new());
288288 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
289289
290290error: use of `unwrap_or` followed by a function call
291- --> $DIR/methods.rs:341 :21
291+ --> $DIR/methods.rs:344 :21
292292 |
293293LL | let _ = stringy.unwrap_or("".to_owned());
294294 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
295295
296296error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
297- --> $DIR/methods.rs:352 :23
297+ --> $DIR/methods.rs:355 :23
298298 |
299299LL | let bad_vec = some_vec.iter().nth(3);
300300 | ^^^^^^^^^^^^^^^^^^^^^^
301301 |
302302 = note: `-D clippy::iter-nth` implied by `-D warnings`
303303
304304error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
305- --> $DIR/methods.rs:353 :26
305+ --> $DIR/methods.rs:356 :26
306306 |
307307LL | let bad_slice = &some_vec[..].iter().nth(3);
308308 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
309309
310310error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
311- --> $DIR/methods.rs:354 :31
311+ --> $DIR/methods.rs:357 :31
312312 |
313313LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
314314 | ^^^^^^^^^^^^^^^^^^^^^^^^^
315315
316316error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
317- --> $DIR/methods.rs:355 :29
317+ --> $DIR/methods.rs:358 :29
318318 |
319319LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
320320 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321321
322322error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
323- --> $DIR/methods.rs:360 :23
323+ --> $DIR/methods.rs:363 :23
324324 |
325325LL | let bad_vec = some_vec.iter_mut().nth(3);
326326 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
327327
328328error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
329- --> $DIR/methods.rs:363 :26
329+ --> $DIR/methods.rs:366 :26
330330 |
331331LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
332332 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
333333
334334error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
335- --> $DIR/methods.rs:366 :29
335+ --> $DIR/methods.rs:369 :29
336336 |
337337LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
338338 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
339339
340340error: 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
341- --> $DIR/methods.rs:378 :13
341+ --> $DIR/methods.rs:381 :13
342342 |
343343LL | let _ = opt.unwrap();
344344 | ^^^^^^^^^^^^
0 commit comments