1 error: defining a method called `add` on this type; consider implementing the `std::ops::Add` trait or choosing a less ambiguous name
2 --> $DIR/methods.rs:21:5
4 21 | pub fn add(self, other: T) -> T { self }
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 = note: `-D should-implement-trait` implied by `-D warnings`
9 error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
10 --> $DIR/methods.rs:32:17
12 32 | fn into_u16(&self) -> u16 { 0 }
15 = note: `-D wrong-self-convention` implied by `-D warnings`
17 error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
18 --> $DIR/methods.rs:34:21
20 34 | fn to_something(self) -> u32 { 0 }
23 error: methods called `new` usually take no self; consider choosing a less ambiguous name
24 --> $DIR/methods.rs:36:12
29 error: methods called `new` usually return `Self`
30 --> $DIR/methods.rs:36:5
35 = note: `-D new-ret-no-self` implied by `-D warnings`
37 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
38 --> $DIR/methods.rs:104:13
40 104 | let _ = opt.map(|x| x + 1)
43 106 | | .unwrap_or(0); // should lint even though this call is on a separate line
44 | |____________________________^
46 = note: `-D option-map-unwrap-or` implied by `-D warnings`
47 = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
49 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
50 --> $DIR/methods.rs:108:13
52 108 | let _ = opt.map(|x| {
56 111 | | ).unwrap_or(0);
57 | |____________________________^
59 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
60 --> $DIR/methods.rs:112:13
62 112 | let _ = opt.map(|x| x + 1)
67 | |__________________^
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:117:13
72 117 | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
73 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
77 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
78 --> $DIR/methods.rs:119:13
80 119 | let _ = opt.map(|x| {
84 122 | | ).unwrap_or(None);
85 | |_____________________^
87 error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
88 --> $DIR/methods.rs:123:13
92 124 | | .map(|x| Some(x + 1))
93 125 | | .unwrap_or(None);
94 | |________________________^
96 = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
98 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
99 --> $DIR/methods.rs:131:13
101 131 | let _ = opt.map(|x| x + 1)
104 133 | | .unwrap_or_else(|| 0); // should lint even though this call is on a separate line
105 | |____________________________________^
107 = note: `-D option-map-unwrap-or-else` implied by `-D warnings`
108 = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
110 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
111 --> $DIR/methods.rs:135:13
113 135 | let _ = opt.map(|x| {
117 138 | | ).unwrap_or_else(|| 0);
118 | |____________________________________^
120 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
121 --> $DIR/methods.rs:139:13
123 139 | let _ = opt.map(|x| x + 1)
125 140 | | .unwrap_or_else(||
128 | |_________________^
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:148:13
133 148 | let _ = opt.map_or(None, |x| Some(x + 1));
134 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
136 = note: `-D option-map-or-none` implied by `-D warnings`
138 error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
139 --> $DIR/methods.rs:150:13
141 150 | let _ = opt.map_or(None, |x| {
146 | |_________________^
147 help: try using and_then instead
149 150 | let _ = opt.and_then(|x| {
154 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
155 --> $DIR/methods.rs:163:13
157 163 | let _ = res.map(|x| x + 1)
160 165 | | .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
161 | |_____________________________________^
163 = note: `-D result-map-unwrap-or-else` implied by `-D warnings`
164 = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)`
166 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
167 --> $DIR/methods.rs:167:13
169 167 | let _ = res.map(|x| {
173 170 | | ).unwrap_or_else(|e| 0);
174 | |_____________________________________^
176 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
177 --> $DIR/methods.rs:171:13
179 171 | let _ = res.map(|x| x + 1)
181 172 | | .unwrap_or_else(|e|
184 | |_________________^
186 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
187 --> $DIR/methods.rs:234:13
189 234 | let _ = v.iter().filter(|&x| *x < 0).next();
190 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 = note: `-D filter-next` implied by `-D warnings`
193 = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
195 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
196 --> $DIR/methods.rs:237:13
198 237 | let _ = v.iter().filter(|&x| {
203 | |___________________________^
205 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
206 --> $DIR/methods.rs:252:13
208 252 | let _ = v.iter().find(|&x| *x < 0).is_some();
209 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 = note: `-D search-is-some` implied by `-D warnings`
212 = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
214 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
215 --> $DIR/methods.rs:255:13
217 255 | let _ = v.iter().find(|&x| {
222 | |______________________________^
224 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
225 --> $DIR/methods.rs:261:13
227 261 | let _ = v.iter().position(|&x| x < 0).is_some();
228 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230 = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
232 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
233 --> $DIR/methods.rs:264:13
235 264 | let _ = v.iter().position(|&x| {
240 | |______________________________^
242 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
243 --> $DIR/methods.rs:270:13
245 270 | let _ = v.iter().rposition(|&x| x < 0).is_some();
246 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
248 = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
250 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
251 --> $DIR/methods.rs:273:13
253 273 | let _ = v.iter().rposition(|&x| {
258 | |______________________________^
260 error: use of `unwrap_or` followed by a function call
261 --> $DIR/methods.rs:308:22
263 308 | with_constructor.unwrap_or(make());
264 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
266 = note: `-D or-fun-call` implied by `-D warnings`
268 error: use of `unwrap_or` followed by a call to `new`
269 --> $DIR/methods.rs:311:5
271 311 | with_new.unwrap_or(Vec::new());
272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
274 error: use of `unwrap_or` followed by a function call
275 --> $DIR/methods.rs:314:21
277 314 | with_const_args.unwrap_or(Vec::with_capacity(12));
278 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
280 error: use of `unwrap_or` followed by a function call
281 --> $DIR/methods.rs:317:14
283 317 | with_err.unwrap_or(make());
284 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
286 error: use of `unwrap_or` followed by a function call
287 --> $DIR/methods.rs:320:19
289 320 | with_err_args.unwrap_or(Vec::with_capacity(12));
290 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
292 error: use of `unwrap_or` followed by a call to `default`
293 --> $DIR/methods.rs:323:5
295 323 | with_default_trait.unwrap_or(Default::default());
296 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
298 error: use of `unwrap_or` followed by a call to `default`
299 --> $DIR/methods.rs:326:5
301 326 | with_default_type.unwrap_or(u64::default());
302 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
304 error: use of `unwrap_or` followed by a function call
305 --> $DIR/methods.rs:329:14
307 329 | with_vec.unwrap_or(vec![]);
308 | ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))`
310 error: use of `unwrap_or` followed by a function call
311 --> $DIR/methods.rs:334:21
313 334 | without_default.unwrap_or(Foo::new());
314 | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
316 error: use of `or_insert` followed by a function call
317 --> $DIR/methods.rs:337:19
319 337 | map.entry(42).or_insert(String::new());
320 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
322 error: use of `or_insert` followed by a function call
323 --> $DIR/methods.rs:340:21
325 340 | btree.entry(42).or_insert(String::new());
326 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(String::new)`
328 error: use of `unwrap_or` followed by a function call
329 --> $DIR/methods.rs:343:21
331 343 | let _ = stringy.unwrap_or("".to_owned());
332 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
334 error: use of `expect` followed by a function call
335 --> $DIR/methods.rs:366:26
337 366 | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
338 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
340 = note: `-D expect-fun-call` implied by `-D warnings`
342 error: use of `expect` followed by a function call
343 --> $DIR/methods.rs:369:26
345 369 | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
346 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!(format!("Error {}: fake error", error_code).as_str()))`
348 error: use of `expect` followed by a function call
349 --> $DIR/methods.rs:379:25
351 379 | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
352 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
354 error: use of `expect` followed by a function call
355 --> $DIR/methods.rs:382:25
357 382 | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
358 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!(format!("Error {}: fake error", error_code).as_str()))`
360 error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
361 --> $DIR/methods.rs:402:23
363 402 | let bad_vec = some_vec.iter().nth(3);
364 | ^^^^^^^^^^^^^^^^^^^^^^
366 = note: `-D iter-nth` implied by `-D warnings`
368 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
369 --> $DIR/methods.rs:403:26
371 403 | let bad_slice = &some_vec[..].iter().nth(3);
372 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
374 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
375 --> $DIR/methods.rs:404:31
377 404 | let bad_boxed_slice = boxed_slice.iter().nth(3);
378 | ^^^^^^^^^^^^^^^^^^^^^^^^^
380 error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
381 --> $DIR/methods.rs:405:29
383 405 | let bad_vec_deque = some_vec_deque.iter().nth(3);
384 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
386 error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
387 --> $DIR/methods.rs:410:23
389 410 | let bad_vec = some_vec.iter_mut().nth(3);
390 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
392 error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
393 --> $DIR/methods.rs:413:26
395 413 | let bad_slice = &some_vec[..].iter_mut().nth(3);
396 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
398 error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
399 --> $DIR/methods.rs:416:29
401 416 | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
402 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
404 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
405 --> $DIR/methods.rs:428:13
407 428 | let _ = some_vec.iter().skip(42).next();
408 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
410 = note: `-D iter-skip-next` implied by `-D warnings`
412 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
413 --> $DIR/methods.rs:429:13
415 429 | let _ = some_vec.iter().cycle().skip(42).next();
416 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
418 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
419 --> $DIR/methods.rs:430:13
421 430 | let _ = (1..10).skip(10).next();
422 | ^^^^^^^^^^^^^^^^^^^^^^^
424 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
425 --> $DIR/methods.rs:431:14
427 431 | let _ = &some_vec[..].iter().skip(3).next();
428 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
430 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
431 --> $DIR/methods.rs:440:13
433 440 | let _ = opt.unwrap();
436 = note: `-D option-unwrap-used` implied by `-D warnings`
438 error: aborting due to 55 previous errors