1 error: unnecessary structure name repetition
2 --> $DIR/methods.rs:20:25
4 20 | fn add(self, other: T) -> T { self }
5 | ^ help: use the applicable keyword: `Self`
7 = note: `-D use-self` implied by `-D warnings`
9 error: unnecessary structure name repetition
10 --> $DIR/methods.rs:20:31
12 20 | fn add(self, other: T) -> T { self }
13 | ^ help: use the applicable keyword: `Self`
15 error: unnecessary structure name repetition
16 --> $DIR/methods.rs:23:26
18 23 | fn sub(&self, other: T) -> &T { self } // no error, self is a ref
19 | ^ help: use the applicable keyword: `Self`
21 error: unnecessary structure name repetition
22 --> $DIR/methods.rs:23:33
24 23 | fn sub(&self, other: T) -> &T { self } // no error, self is a ref
25 | ^ help: use the applicable keyword: `Self`
27 error: unnecessary structure name repetition
28 --> $DIR/methods.rs:24:21
30 24 | fn div(self) -> T { self } // no error, different #arguments
31 | ^ help: use the applicable keyword: `Self`
33 error: unnecessary structure name repetition
34 --> $DIR/methods.rs:25:25
36 25 | fn rem(self, other: T) { } // no error, wrong return type
37 | ^ help: use the applicable keyword: `Self`
39 error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name
40 --> $DIR/methods.rs:20:5
42 20 | fn add(self, other: T) -> T { self }
43 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 = note: `-D should-implement-trait` implied by `-D warnings`
47 error: defining a method called `drop` on this type; consider implementing the `std::ops::Drop` trait or choosing a less ambiguous name
48 --> $DIR/methods.rs:21:5
50 21 | fn drop(&mut self) { }
51 | ^^^^^^^^^^^^^^^^^^^^^^
53 error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
54 --> $DIR/methods.rs:28:17
56 28 | fn into_u16(&self) -> u16 { 0 }
59 = note: `-D wrong-self-convention` implied by `-D warnings`
61 error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
62 --> $DIR/methods.rs:30:21
64 30 | fn to_something(self) -> u32 { 0 }
67 error: methods called `new` usually take no self; consider choosing a less ambiguous name
68 --> $DIR/methods.rs:32:12
73 error: methods called `new` usually return `Self`
74 --> $DIR/methods.rs:32:5
79 = note: `-D new-ret-no-self` implied by `-D warnings`
81 error: unnecessary structure name repetition
82 --> $DIR/methods.rs:76:24
84 76 | fn new() -> Option<V<T>> { None }
85 | ^^^^ help: use the applicable keyword: `Self`
87 error: unnecessary structure name repetition
88 --> $DIR/methods.rs:80:19
91 | ^ help: use the applicable keyword: `Self`
93 error: unnecessary structure name repetition
94 --> $DIR/methods.rs:81:25
96 81 | fn mul(self, other: T) -> T { self } // no error, obviously
97 | ^ help: use the applicable keyword: `Self`
99 error: unnecessary structure name repetition
100 --> $DIR/methods.rs:81:31
102 81 | fn mul(self, other: T) -> T { self } // no error, obviously
103 | ^ help: use the applicable keyword: `Self`
105 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
106 --> $DIR/methods.rs:99:13
108 99 | let _ = opt.map(|x| x + 1)
111 101 | | .unwrap_or(0); // should lint even though this call is on a separate line
112 | |____________________________^
114 = note: `-D option-map-unwrap-or` implied by `-D warnings`
115 = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
117 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
118 --> $DIR/methods.rs:103:13
120 103 | let _ = opt.map(|x| {
124 106 | | ).unwrap_or(0);
125 | |____________________________^
127 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
128 --> $DIR/methods.rs:107:13
130 107 | let _ = opt.map(|x| x + 1)
135 | |__________________^
137 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
138 --> $DIR/methods.rs:112:13
140 112 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
145 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
146 --> $DIR/methods.rs:114:13
148 114 | let _ = opt.map(|x| {
152 117 | | ).unwrap_or(None);
153 | |_____________________^
155 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
156 --> $DIR/methods.rs:118:13
160 119 | | .map(|x| Some(x + 1))
161 120 | | .unwrap_or(None);
162 | |________________________^
164 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
166 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
167 --> $DIR/methods.rs:126:13
169 126 | let _ = opt.map(|x| x + 1)
172 128 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line
173 | |____________________________________^
175 = note: `-D option-map-unwrap-or-else` implied by `-D warnings`
176 = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
178 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
179 --> $DIR/methods.rs:130:13
181 130 | let _ = opt.map(|x| {
185 133 | | ).unwrap_or_else(|| 0);
186 | |____________________________________^
188 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
189 --> $DIR/methods.rs:134:13
191 134 | let _ = opt.map(|x| x + 1)
193 135 | | .unwrap_or_else(||
196 | |_________________^
198 error: unnecessary structure name repetition
199 --> $DIR/methods.rs:163:24
201 163 | fn filter(self) -> IteratorFalsePositives {
202 | ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
204 error: unnecessary structure name repetition
205 --> $DIR/methods.rs:167:22
207 167 | fn next(self) -> IteratorFalsePositives {
208 | ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
210 error: unnecessary structure name repetition
211 --> $DIR/methods.rs:187:32
213 187 | fn skip(self, _: usize) -> IteratorFalsePositives {
214 | ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
216 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
217 --> $DIR/methods.rs:197:13
219 197 | let _ = v.iter().filter(|&x| *x < 0).next();
220 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222 = note: `-D filter-next` implied by `-D warnings`
223 = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
225 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
226 --> $DIR/methods.rs:200:13
228 200 | let _ = v.iter().filter(|&x| {
233 | |___________________________^
235 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
236 --> $DIR/methods.rs:215:13
238 215 | let _ = v.iter().find(|&x| *x < 0).is_some();
239 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
241 = note: `-D search-is-some` implied by `-D warnings`
242 = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
244 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
245 --> $DIR/methods.rs:218:13
247 218 | let _ = v.iter().find(|&x| {
252 | |______________________________^
254 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
255 --> $DIR/methods.rs:224:13
257 224 | let _ = v.iter().position(|&x| x < 0).is_some();
258 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
260 = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
262 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
263 --> $DIR/methods.rs:227:13
265 227 | let _ = v.iter().position(|&x| {
270 | |______________________________^
272 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
273 --> $DIR/methods.rs:233:13
275 233 | let _ = v.iter().rposition(|&x| x < 0).is_some();
276 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278 = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
280 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
281 --> $DIR/methods.rs:236:13
283 236 | let _ = v.iter().rposition(|&x| {
288 | |______________________________^
290 error: unnecessary structure name repetition
291 --> $DIR/methods.rs:253:21
293 253 | fn new() -> Foo { Foo }
294 | ^^^ help: use the applicable keyword: `Self`
296 error: use of `unwrap_or` followed by a function call
297 --> $DIR/methods.rs:271:5
299 271 | with_constructor.unwrap_or(make());
300 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)`
302 = note: `-D or-fun-call` implied by `-D warnings`
304 error: use of `unwrap_or` followed by a call to `new`
305 --> $DIR/methods.rs:274:5
307 274 | with_new.unwrap_or(Vec::new());
308 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
310 error: use of `unwrap_or` followed by a function call
311 --> $DIR/methods.rs:277:5
313 277 | with_const_args.unwrap_or(Vec::with_capacity(12));
314 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))`
316 error: use of `unwrap_or` followed by a function call
317 --> $DIR/methods.rs:280:5
319 280 | with_err.unwrap_or(make());
320 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())`
322 error: use of `unwrap_or` followed by a function call
323 --> $DIR/methods.rs:283:5
325 283 | with_err_args.unwrap_or(Vec::with_capacity(12));
326 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))`
328 error: use of `unwrap_or` followed by a call to `default`
329 --> $DIR/methods.rs:286:5
331 286 | with_default_trait.unwrap_or(Default::default());
332 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
334 error: use of `unwrap_or` followed by a call to `default`
335 --> $DIR/methods.rs:289:5
337 289 | with_default_type.unwrap_or(u64::default());
338 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
340 error: use of `unwrap_or` followed by a function call
341 --> $DIR/methods.rs:292:5
343 292 | with_vec.unwrap_or(vec![]);
344 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))`
346 error: use of `unwrap_or` followed by a function call
347 --> $DIR/methods.rs:297:5
349 297 | without_default.unwrap_or(Foo::new());
350 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)`
352 error: use of `or_insert` followed by a function call
353 --> $DIR/methods.rs:300:5
355 300 | map.entry(42).or_insert(String::new());
356 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)`
358 error: use of `or_insert` followed by a function call
359 --> $DIR/methods.rs:303:5
361 303 | btree.entry(42).or_insert(String::new());
362 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)`
364 error: use of `unwrap_or` followed by a function call
365 --> $DIR/methods.rs:306:13
367 306 | let _ = stringy.unwrap_or("".to_owned());
368 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())`
370 error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
371 --> $DIR/methods.rs:317:23
373 317 | let bad_vec = some_vec.iter().nth(3);
374 | ^^^^^^^^^^^^^^^^^^^^^^
376 = note: `-D iter-nth` implied by `-D warnings`
378 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
379 --> $DIR/methods.rs:318:26
381 318 | let bad_slice = &some_vec[..].iter().nth(3);
382 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
384 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
385 --> $DIR/methods.rs:319:31
387 319 | let bad_boxed_slice = boxed_slice.iter().nth(3);
388 | ^^^^^^^^^^^^^^^^^^^^^^^^^
390 error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
391 --> $DIR/methods.rs:320:29
393 320 | let bad_vec_deque = some_vec_deque.iter().nth(3);
394 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
396 error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
397 --> $DIR/methods.rs:325:23
399 325 | let bad_vec = some_vec.iter_mut().nth(3);
400 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
402 error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
403 --> $DIR/methods.rs:328:26
405 328 | let bad_slice = &some_vec[..].iter_mut().nth(3);
406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
408 error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
409 --> $DIR/methods.rs:331:29
411 331 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
412 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
414 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
415 --> $DIR/methods.rs:343:13
417 343 | let _ = some_vec.iter().skip(42).next();
418 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
420 = note: `-D iter-skip-next` implied by `-D warnings`
422 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
423 --> $DIR/methods.rs:344:13
425 344 | let _ = some_vec.iter().cycle().skip(42).next();
426 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
428 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
429 --> $DIR/methods.rs:345:13
431 345 | let _ = (1..10).skip(10).next();
432 | ^^^^^^^^^^^^^^^^^^^^^^^
434 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
435 --> $DIR/methods.rs:346:14
437 346 | let _ = &some_vec[..].iter().skip(3).next();
438 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
440 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
441 --> $DIR/methods.rs:355:13
443 355 | let _ = opt.unwrap();
446 = note: `-D option-unwrap-used` implied by `-D warnings`