@@ -27,7 +27,7 @@ LL | fn new(self) -> Self { unimplemented!(); }
27
27
| ^^^^
28
28
29
29
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
30
- --> $DIR/methods.rs:111 :13
30
+ --> $DIR/methods.rs:112 :13
31
31
|
32
32
LL | let _ = opt.map(|x| x + 1)
33
33
| _____________^
@@ -39,7 +39,7 @@ LL | | .unwrap_or(0); // should lint even though this call is on
39
39
= note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
40
40
41
41
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
42
- --> $DIR/methods.rs:115 :13
42
+ --> $DIR/methods.rs:116 :13
43
43
|
44
44
LL | let _ = opt.map(|x| {
45
45
| _____________^
@@ -49,7 +49,7 @@ LL | | ).unwrap_or(0);
49
49
| |____________________________^
50
50
51
51
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
52
- --> $DIR/methods.rs:119 :13
52
+ --> $DIR/methods.rs:120 :13
53
53
|
54
54
LL | let _ = opt.map(|x| x + 1)
55
55
| _____________^
@@ -59,15 +59,15 @@ LL | | });
59
59
| |__________________^
60
60
61
61
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
62
- --> $DIR/methods.rs:124 :13
62
+ --> $DIR/methods.rs:125 :13
63
63
|
64
64
LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
65
65
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
66
|
67
67
= note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
68
68
69
69
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
70
- --> $DIR/methods.rs:126 :13
70
+ --> $DIR/methods.rs:127 :13
71
71
|
72
72
LL | let _ = opt.map(|x| {
73
73
| _____________^
@@ -77,7 +77,7 @@ LL | | ).unwrap_or(None);
77
77
| |_____________________^
78
78
79
79
error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
80
- --> $DIR/methods.rs:130 :13
80
+ --> $DIR/methods.rs:131 :13
81
81
|
82
82
LL | let _ = opt
83
83
| _____________^
@@ -88,7 +88,7 @@ LL | | .unwrap_or(None);
88
88
= note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
89
89
90
90
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
91
- --> $DIR/methods.rs:138 :13
91
+ --> $DIR/methods.rs:139 :13
92
92
|
93
93
LL | let _ = opt.map(|x| x + 1)
94
94
| _____________^
@@ -100,7 +100,7 @@ LL | | .unwrap_or_else(|| 0); // should lint even though this cal
100
100
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
101
101
102
102
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
103
- --> $DIR/methods.rs:142 :13
103
+ --> $DIR/methods.rs:143 :13
104
104
|
105
105
LL | let _ = opt.map(|x| {
106
106
| _____________^
@@ -110,7 +110,7 @@ LL | | ).unwrap_or_else(|| 0);
110
110
| |____________________________________^
111
111
112
112
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
113
- --> $DIR/methods.rs:146 :13
113
+ --> $DIR/methods.rs:147 :13
114
114
|
115
115
LL | let _ = opt.map(|x| x + 1)
116
116
| _____________^
@@ -120,15 +120,15 @@ LL | | );
120
120
| |_________________^
121
121
122
122
error: 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:156 :13
124
124
|
125
125
LL | let _ = opt.map_or(None, |x| Some(x + 1));
126
126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
127
127
|
128
128
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
129
129
130
130
error: 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:158 :13
132
132
|
133
133
LL | let _ = opt.map_or(None, |x| {
134
134
| _____________^
@@ -144,7 +144,7 @@ LL | });
144
144
|
145
145
146
146
error: 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:184 :13
148
148
|
149
149
LL | let _ = v.iter().filter(|&x| *x < 0).next();
150
150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -153,7 +153,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
153
153
= note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
154
154
155
155
error: 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:187 :13
157
157
|
158
158
LL | let _ = v.iter().filter(|&x| {
159
159
| _____________^
@@ -163,7 +163,7 @@ LL | | ).next();
163
163
| |___________________________^
164
164
165
165
error: 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
167
167
|
168
168
LL | let _ = v.iter().find(|&x| *x < 0).is_some();
169
169
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -172,7 +172,7 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
172
172
= note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
173
173
174
174
error: 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
176
176
|
177
177
LL | let _ = v.iter().find(|&x| {
178
178
| _____________^
@@ -182,15 +182,15 @@ LL | | ).is_some();
182
182
| |______________________________^
183
183
184
184
error: 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
186
186
|
187
187
LL | let _ = v.iter().position(|&x| x < 0).is_some();
188
188
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189
189
|
190
190
= note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
191
191
192
192
error: 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
194
194
|
195
195
LL | let _ = v.iter().position(|&x| {
196
196
| _____________^
@@ -200,15 +200,15 @@ LL | | ).is_some();
200
200
| |______________________________^
201
201
202
202
error: 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
204
204
|
205
205
LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
206
206
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207
207
|
208
208
= note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
209
209
210
210
error: 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
212
212
|
213
213
LL | let _ = v.iter().rposition(|&x| {
214
214
| _____________^
@@ -218,125 +218,125 @@ LL | | ).is_some();
218
218
| |______________________________^
219
219
220
220
error: use of `unwrap_or` followed by a function call
221
- --> $DIR/methods.rs:256 :22
221
+ --> $DIR/methods.rs:259 :22
222
222
|
223
223
LL | with_constructor.unwrap_or(make());
224
224
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
225
225
|
226
226
= note: `-D clippy::or-fun-call` implied by `-D warnings`
227
227
228
228
error: use of `unwrap_or` followed by a call to `new`
229
- --> $DIR/methods.rs:259 :5
229
+ --> $DIR/methods.rs:262 :5
230
230
|
231
231
LL | with_new.unwrap_or(Vec::new());
232
232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
233
233
234
234
error: use of `unwrap_or` followed by a function call
235
- --> $DIR/methods.rs:262 :21
235
+ --> $DIR/methods.rs:265 :21
236
236
|
237
237
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
238
238
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
239
239
240
240
error: use of `unwrap_or` followed by a function call
241
- --> $DIR/methods.rs:265 :14
241
+ --> $DIR/methods.rs:268 :14
242
242
|
243
243
LL | with_err.unwrap_or(make());
244
244
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
245
245
246
246
error: use of `unwrap_or` followed by a function call
247
- --> $DIR/methods.rs:268 :19
247
+ --> $DIR/methods.rs:271 :19
248
248
|
249
249
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
250
250
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
251
251
252
252
error: use of `unwrap_or` followed by a call to `default`
253
- --> $DIR/methods.rs:271 :5
253
+ --> $DIR/methods.rs:274 :5
254
254
|
255
255
LL | with_default_trait.unwrap_or(Default::default());
256
256
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
257
257
258
258
error: use of `unwrap_or` followed by a call to `default`
259
- --> $DIR/methods.rs:274 :5
259
+ --> $DIR/methods.rs:277 :5
260
260
|
261
261
LL | with_default_type.unwrap_or(u64::default());
262
262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
263
263
264
264
error: use of `unwrap_or` followed by a function call
265
- --> $DIR/methods.rs:277 :14
265
+ --> $DIR/methods.rs:280 :14
266
266
|
267
267
LL | with_vec.unwrap_or(vec![]);
268
268
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| vec![])`
269
269
270
270
error: use of `unwrap_or` followed by a function call
271
- --> $DIR/methods.rs:282 :21
271
+ --> $DIR/methods.rs:285 :21
272
272
|
273
273
LL | without_default.unwrap_or(Foo::new());
274
274
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
275
275
276
276
error: use of `or_insert` followed by a function call
277
- --> $DIR/methods.rs:285 :19
277
+ --> $DIR/methods.rs:288 :19
278
278
|
279
279
LL | map.entry(42).or_insert(String::new());
280
280
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
281
281
282
282
error: use of `or_insert` followed by a function call
283
- --> $DIR/methods.rs:288 :21
283
+ --> $DIR/methods.rs:291 :21
284
284
|
285
285
LL | btree.entry(42).or_insert(String::new());
286
286
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
287
287
288
288
error: use of `unwrap_or` followed by a function call
289
- --> $DIR/methods.rs:291 :21
289
+ --> $DIR/methods.rs:294 :21
290
290
|
291
291
LL | let _ = stringy.unwrap_or("".to_owned());
292
292
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
293
293
294
294
error: 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
296
296
|
297
297
LL | let bad_vec = some_vec.iter().nth(3);
298
298
| ^^^^^^^^^^^^^^^^^^^^^^
299
299
|
300
300
= note: `-D clippy::iter-nth` implied by `-D warnings`
301
301
302
302
error: 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
304
304
|
305
305
LL | let bad_slice = &some_vec[..].iter().nth(3);
306
306
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
307
307
308
308
error: 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
310
310
|
311
311
LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
312
312
| ^^^^^^^^^^^^^^^^^^^^^^^^^
313
313
314
314
error: 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
316
316
|
317
317
LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
318
318
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
319
319
320
320
error: 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
322
322
|
323
323
LL | let bad_vec = some_vec.iter_mut().nth(3);
324
324
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
325
325
326
326
error: 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
328
328
|
329
329
LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
330
330
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
331
331
332
332
error: 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
334
334
|
335
335
LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
336
336
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
337
337
338
338
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
339
- --> $DIR/methods.rs:328 :13
339
+ --> $DIR/methods.rs:331 :13
340
340
|
341
341
LL | let _ = opt.unwrap();
342
342
| ^^^^^^^^^^^^
0 commit comments