@@ -90,7 +90,7 @@ LL | | .unwrap_or(None);
90
90
= note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
91
91
92
92
error: 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
94
94
|
95
95
LL | let _ = opt.map(|x| x + 1)
96
96
| _____________^
@@ -102,7 +102,7 @@ LL | | .unwrap_or_else(|| 0); // should lint even though this cal
102
102
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
103
103
104
104
error: 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
106
106
|
107
107
LL | let _ = opt.map(|x| {
108
108
| _____________^
@@ -112,7 +112,7 @@ LL | | ).unwrap_or_else(|| 0);
112
112
| |____________________________________^
113
113
114
114
error: 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
116
116
|
117
117
LL | let _ = opt.map(|x| x + 1)
118
118
| _____________^
@@ -122,15 +122,15 @@ LL | | );
122
122
| |_________________^
123
123
124
124
error: 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
126
126
|
127
127
LL | let _ = opt.map_or(None, |x| Some(x + 1));
128
128
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
129
129
|
130
130
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
131
131
132
132
error: 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
134
134
|
135
135
LL | let _ = opt.map_or(None, |x| {
136
136
| _____________^
@@ -146,7 +146,7 @@ LL | });
146
146
|
147
147
148
148
error: 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
150
150
|
151
151
LL | let _ = v.iter().filter(|&x| *x < 0).next();
152
152
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -155,7 +155,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
155
155
= note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
156
156
157
157
error: 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
159
159
|
160
160
LL | let _ = v.iter().filter(|&x| {
161
161
| _____________^
@@ -165,7 +165,7 @@ LL | | ).next();
165
165
| |___________________________^
166
166
167
167
error: 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
169
169
|
170
170
LL | let _ = v.iter().find(|&x| *x < 0).is_some();
171
171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +174,7 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
174
174
= note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
175
175
176
176
error: 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
178
178
|
179
179
LL | let _ = v.iter().find(|&x| {
180
180
| _____________^
@@ -184,15 +184,15 @@ LL | | ).is_some();
184
184
| |______________________________^
185
185
186
186
error: 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
188
188
|
189
189
LL | let _ = v.iter().position(|&x| x < 0).is_some();
190
190
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191
191
|
192
192
= note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
193
193
194
194
error: 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
196
196
|
197
197
LL | let _ = v.iter().position(|&x| {
198
198
| _____________^
@@ -202,15 +202,15 @@ LL | | ).is_some();
202
202
| |______________________________^
203
203
204
204
error: 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
206
206
|
207
207
LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
208
208
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209
209
|
210
210
= note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
211
211
212
212
error: 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
214
214
|
215
215
LL | let _ = v.iter().rposition(|&x| {
216
216
| _____________^
@@ -220,125 +220,125 @@ LL | | ).is_some();
220
220
| |______________________________^
221
221
222
222
error: use of `unwrap_or` followed by a function call
223
- --> $DIR/methods.rs:306 :22
223
+ --> $DIR/methods.rs:309 :22
224
224
|
225
225
LL | with_constructor.unwrap_or(make());
226
226
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
227
227
|
228
228
= note: `-D clippy::or-fun-call` implied by `-D warnings`
229
229
230
230
error: use of `unwrap_or` followed by a call to `new`
231
- --> $DIR/methods.rs:309 :5
231
+ --> $DIR/methods.rs:312 :5
232
232
|
233
233
LL | with_new.unwrap_or(Vec::new());
234
234
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
235
235
236
236
error: use of `unwrap_or` followed by a function call
237
- --> $DIR/methods.rs:312 :21
237
+ --> $DIR/methods.rs:315 :21
238
238
|
239
239
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
240
240
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
241
241
242
242
error: use of `unwrap_or` followed by a function call
243
- --> $DIR/methods.rs:315 :14
243
+ --> $DIR/methods.rs:318 :14
244
244
|
245
245
LL | with_err.unwrap_or(make());
246
246
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
247
247
248
248
error: use of `unwrap_or` followed by a function call
249
- --> $DIR/methods.rs:318 :19
249
+ --> $DIR/methods.rs:321 :19
250
250
|
251
251
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
252
252
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
253
253
254
254
error: use of `unwrap_or` followed by a call to `default`
255
- --> $DIR/methods.rs:321 :5
255
+ --> $DIR/methods.rs:324 :5
256
256
|
257
257
LL | with_default_trait.unwrap_or(Default::default());
258
258
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
259
259
260
260
error: use of `unwrap_or` followed by a call to `default`
261
- --> $DIR/methods.rs:324 :5
261
+ --> $DIR/methods.rs:327 :5
262
262
|
263
263
LL | with_default_type.unwrap_or(u64::default());
264
264
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
265
265
266
266
error: use of `unwrap_or` followed by a function call
267
- --> $DIR/methods.rs:327 :14
267
+ --> $DIR/methods.rs:330 :14
268
268
|
269
269
LL | with_vec.unwrap_or(vec![]);
270
270
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])`
271
271
272
272
error: use of `unwrap_or` followed by a function call
273
- --> $DIR/methods.rs:332 :21
273
+ --> $DIR/methods.rs:335 :21
274
274
|
275
275
LL | without_default.unwrap_or(Foo::new());
276
276
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
277
277
278
278
error: use of `or_insert` followed by a function call
279
- --> $DIR/methods.rs:335 :19
279
+ --> $DIR/methods.rs:338 :19
280
280
|
281
281
LL | map.entry(42).or_insert(String::new());
282
282
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
283
283
284
284
error: use of `or_insert` followed by a function call
285
- --> $DIR/methods.rs:338 :21
285
+ --> $DIR/methods.rs:341 :21
286
286
|
287
287
LL | btree.entry(42).or_insert(String::new());
288
288
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
289
289
290
290
error: use of `unwrap_or` followed by a function call
291
- --> $DIR/methods.rs:341 :21
291
+ --> $DIR/methods.rs:344 :21
292
292
|
293
293
LL | let _ = stringy.unwrap_or("".to_owned());
294
294
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
295
295
296
296
error: 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
298
298
|
299
299
LL | let bad_vec = some_vec.iter().nth(3);
300
300
| ^^^^^^^^^^^^^^^^^^^^^^
301
301
|
302
302
= note: `-D clippy::iter-nth` implied by `-D warnings`
303
303
304
304
error: 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
306
306
|
307
307
LL | let bad_slice = &some_vec[..].iter().nth(3);
308
308
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
309
309
310
310
error: 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
312
312
|
313
313
LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
314
314
| ^^^^^^^^^^^^^^^^^^^^^^^^^
315
315
316
316
error: 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
318
318
|
319
319
LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
320
320
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321
321
322
322
error: 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
324
324
|
325
325
LL | let bad_vec = some_vec.iter_mut().nth(3);
326
326
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
327
327
328
328
error: 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
330
330
|
331
331
LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
332
332
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
333
333
334
334
error: 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
336
336
|
337
337
LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
338
338
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
339
339
340
340
error: 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
342
342
|
343
343
LL | let _ = opt.unwrap();
344
344
| ^^^^^^^^^^^^
0 commit comments