]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods.stderr
Don't trigger `Self` suggestion inside derives
[rust.git] / tests / ui / methods.stderr
1 error: unnecessary structure name repetition
2   --> $DIR/methods.rs:18:25
3    |
4 18 |     fn add(self, other: T) -> T { self }
5    |                         ^ help: use the applicable keyword: `Self`
6    |
7    = note: `-D use-self` implied by `-D warnings`
8
9 error: unnecessary structure name repetition
10   --> $DIR/methods.rs:18:31
11    |
12 18 |     fn add(self, other: T) -> T { self }
13    |                               ^ help: use the applicable keyword: `Self`
14
15 error: unnecessary structure name repetition
16   --> $DIR/methods.rs:21:26
17    |
18 21 |     fn sub(&self, other: T) -> &T { self } // no error, self is a ref
19    |                          ^ help: use the applicable keyword: `Self`
20
21 error: unnecessary structure name repetition
22   --> $DIR/methods.rs:21:33
23    |
24 21 |     fn sub(&self, other: T) -> &T { self } // no error, self is a ref
25    |                                 ^ help: use the applicable keyword: `Self`
26
27 error: unnecessary structure name repetition
28   --> $DIR/methods.rs:22:21
29    |
30 22 |     fn div(self) -> T { self } // no error, different #arguments
31    |                     ^ help: use the applicable keyword: `Self`
32
33 error: unnecessary structure name repetition
34   --> $DIR/methods.rs:23:25
35    |
36 23 |     fn rem(self, other: T) { } // no error, wrong return type
37    |                         ^ help: use the applicable keyword: `Self`
38
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:18:5
41    |
42 18 |     fn add(self, other: T) -> T { self }
43    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44    |
45    = note: `-D should-implement-trait` implied by `-D warnings`
46
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:19:5
49    |
50 19 |     fn drop(&mut self) { }
51    |     ^^^^^^^^^^^^^^^^^^^^^^
52
53 error: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
54   --> $DIR/methods.rs:26:17
55    |
56 26 |     fn into_u16(&self) -> u16 { 0 }
57    |                 ^^^^^
58    |
59    = note: `-D wrong-self-convention` implied by `-D warnings`
60
61 error: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
62   --> $DIR/methods.rs:28:21
63    |
64 28 |     fn to_something(self) -> u32 { 0 }
65    |                     ^^^^
66
67 error: methods called `new` usually take no self; consider choosing a less ambiguous name
68   --> $DIR/methods.rs:30:12
69    |
70 30 |     fn new(self) {}
71    |            ^^^^
72
73 error: methods called `new` usually return `Self`
74   --> $DIR/methods.rs:30:5
75    |
76 30 |     fn new(self) {}
77    |     ^^^^^^^^^^^^^^^
78    |
79    = note: `-D new-ret-no-self` implied by `-D warnings`
80
81 error: unnecessary structure name repetition
82   --> $DIR/methods.rs:40:35
83    |
84 40 |     pub fn new<'b>(s: &'b str) -> Lt<'b> { unimplemented!() }
85    |                                   ^^^^^^ help: use the applicable keyword: `Self`
86
87 error: unnecessary structure name repetition
88   --> $DIR/methods.rs:49:28
89    |
90 49 |     pub fn new(s: &str) -> Lt2 { unimplemented!() }
91    |                            ^^^ help: use the applicable keyword: `Self`
92
93 error: unnecessary structure name repetition
94   --> $DIR/methods.rs:58:21
95    |
96 58 |     pub fn new() -> Lt3<'static> { unimplemented!() }
97    |                     ^^^^^^^^^^^^ help: use the applicable keyword: `Self`
98
99 error: unnecessary structure name repetition
100   --> $DIR/methods.rs:74:24
101    |
102 74 |     fn new() -> Option<V<T>> { None }
103    |                        ^^^^ help: use the applicable keyword: `Self`
104
105 error: unnecessary structure name repetition
106   --> $DIR/methods.rs:78:19
107    |
108 78 |     type Output = T;
109    |                   ^ help: use the applicable keyword: `Self`
110
111 error: unnecessary structure name repetition
112   --> $DIR/methods.rs:79:25
113    |
114 79 |     fn mul(self, other: T) -> T { self } // no error, obviously
115    |                         ^ help: use the applicable keyword: `Self`
116
117 error: unnecessary structure name repetition
118   --> $DIR/methods.rs:79:31
119    |
120 79 |     fn mul(self, other: T) -> T { self } // no error, obviously
121    |                               ^ help: use the applicable keyword: `Self`
122
123 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
124   --> $DIR/methods.rs:97:13
125    |
126 97 |       let _ = opt.map(|x| x + 1)
127    |  _____________^
128 98 | |
129 99 | |                .unwrap_or(0); // should lint even though this call is on a separate line
130    | |____________________________^
131    |
132    = note: `-D option-map-unwrap-or` implied by `-D warnings`
133    = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
134
135 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
136    --> $DIR/methods.rs:101:13
137     |
138 101 |       let _ = opt.map(|x| {
139     |  _____________^
140 102 | |                         x + 1
141 103 | |                     }
142 104 | |               ).unwrap_or(0);
143     | |____________________________^
144
145 error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
146    --> $DIR/methods.rs:105:13
147     |
148 105 |       let _ = opt.map(|x| x + 1)
149     |  _____________^
150 106 | |                .unwrap_or({
151 107 | |                     0
152 108 | |                 });
153     | |__________________^
154
155 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
156    --> $DIR/methods.rs:114:13
157     |
158 114 |       let _ = opt.map(|x| x + 1)
159     |  _____________^
160 115 | |
161 116 | |                .unwrap_or_else(|| 0); // should lint even though this call is on a separate line
162     | |____________________________________^
163     |
164     = note: `-D option-map-unwrap-or-else` implied by `-D warnings`
165     = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
166
167 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
168    --> $DIR/methods.rs:118:13
169     |
170 118 |       let _ = opt.map(|x| {
171     |  _____________^
172 119 | |                         x + 1
173 120 | |                     }
174 121 | |               ).unwrap_or_else(|| 0);
175     | |____________________________________^
176
177 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
178    --> $DIR/methods.rs:122:13
179     |
180 122 |       let _ = opt.map(|x| x + 1)
181     |  _____________^
182 123 | |                .unwrap_or_else(||
183 124 | |                     0
184 125 | |                 );
185     | |_________________^
186
187 error: unnecessary structure name repetition
188    --> $DIR/methods.rs:151:24
189     |
190 151 |     fn filter(self) -> IteratorFalsePositives {
191     |                        ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
192
193 error: unnecessary structure name repetition
194    --> $DIR/methods.rs:155:22
195     |
196 155 |     fn next(self) -> IteratorFalsePositives {
197     |                      ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
198
199 error: unnecessary structure name repetition
200    --> $DIR/methods.rs:175:32
201     |
202 175 |     fn skip(self, _: usize) -> IteratorFalsePositives {
203     |                                ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
204
205 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
206    --> $DIR/methods.rs:194:13
207     |
208 194 |     let _ = v.iter().filter(|&x| *x < 0).next();
209     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
210     |
211     = note: `-D filter-next` implied by `-D warnings`
212     = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
213
214 error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
215    --> $DIR/methods.rs:197:13
216     |
217 197 |       let _ = v.iter().filter(|&x| {
218     |  _____________^
219 198 | |                                 *x < 0
220 199 | |                             }
221 200 | |                    ).next();
222     | |___________________________^
223
224 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
225    --> $DIR/methods.rs:212:13
226     |
227 212 |     let _ = v.iter().find(|&x| *x < 0).is_some();
228     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
229     |
230     = note: `-D search-is-some` implied by `-D warnings`
231     = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
232
233 error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
234    --> $DIR/methods.rs:215:13
235     |
236 215 |       let _ = v.iter().find(|&x| {
237     |  _____________^
238 216 | |                               *x < 0
239 217 | |                           }
240 218 | |                    ).is_some();
241     | |______________________________^
242
243 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
244    --> $DIR/methods.rs:221:13
245     |
246 221 |     let _ = v.iter().position(|&x| x < 0).is_some();
247     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
248     |
249     = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
250
251 error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
252    --> $DIR/methods.rs:224:13
253     |
254 224 |       let _ = v.iter().position(|&x| {
255     |  _____________^
256 225 | |                                   x < 0
257 226 | |                               }
258 227 | |                    ).is_some();
259     | |______________________________^
260
261 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
262    --> $DIR/methods.rs:230:13
263     |
264 230 |     let _ = v.iter().rposition(|&x| x < 0).is_some();
265     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266     |
267     = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
268
269 error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
270    --> $DIR/methods.rs:233:13
271     |
272 233 |       let _ = v.iter().rposition(|&x| {
273     |  _____________^
274 234 | |                                    x < 0
275 235 | |                                }
276 236 | |                    ).is_some();
277     | |______________________________^
278
279 error: unnecessary structure name repetition
280    --> $DIR/methods.rs:250:21
281     |
282 250 |         fn new() -> Foo { Foo }
283     |                     ^^^ help: use the applicable keyword: `Self`
284
285 error: use of `unwrap_or` followed by a function call
286    --> $DIR/methods.rs:268:5
287     |
288 268 |     with_constructor.unwrap_or(make());
289     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)`
290     |
291     = note: `-D or-fun-call` implied by `-D warnings`
292
293 error: use of `unwrap_or` followed by a call to `new`
294    --> $DIR/methods.rs:271:5
295     |
296 271 |     with_new.unwrap_or(Vec::new());
297     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
298
299 error: use of `unwrap_or` followed by a function call
300    --> $DIR/methods.rs:274:5
301     |
302 274 |     with_const_args.unwrap_or(Vec::with_capacity(12));
303     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_const_args.unwrap_or_else(|| Vec::with_capacity(12))`
304
305 error: use of `unwrap_or` followed by a function call
306    --> $DIR/methods.rs:277:5
307     |
308 277 |     with_err.unwrap_or(make());
309     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())`
310
311 error: use of `unwrap_or` followed by a function call
312    --> $DIR/methods.rs:280:5
313     |
314 280 |     with_err_args.unwrap_or(Vec::with_capacity(12));
315     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err_args.unwrap_or_else(|_| Vec::with_capacity(12))`
316
317 error: use of `unwrap_or` followed by a call to `default`
318    --> $DIR/methods.rs:283:5
319     |
320 283 |     with_default_trait.unwrap_or(Default::default());
321     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
322
323 error: use of `unwrap_or` followed by a call to `default`
324    --> $DIR/methods.rs:286:5
325     |
326 286 |     with_default_type.unwrap_or(u64::default());
327     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
328
329 error: use of `unwrap_or` followed by a function call
330    --> $DIR/methods.rs:289:5
331     |
332 289 |     with_vec.unwrap_or(vec![]);
333     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))`
334
335 error: use of `unwrap_or` followed by a function call
336    --> $DIR/methods.rs:294:5
337     |
338 294 |     without_default.unwrap_or(Foo::new());
339     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)`
340
341 error: use of `or_insert` followed by a function call
342    --> $DIR/methods.rs:297:5
343     |
344 297 |     map.entry(42).or_insert(String::new());
345     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)`
346
347 error: use of `or_insert` followed by a function call
348    --> $DIR/methods.rs:300:5
349     |
350 300 |     btree.entry(42).or_insert(String::new());
351     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)`
352
353 error: use of `unwrap_or` followed by a function call
354    --> $DIR/methods.rs:303:13
355     |
356 303 |     let _ = stringy.unwrap_or("".to_owned());
357     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())`
358
359 error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
360    --> $DIR/methods.rs:314:23
361     |
362 314 |         let bad_vec = some_vec.iter().nth(3);
363     |                       ^^^^^^^^^^^^^^^^^^^^^^
364     |
365     = note: `-D iter-nth` implied by `-D warnings`
366
367 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
368    --> $DIR/methods.rs:315:26
369     |
370 315 |         let bad_slice = &some_vec[..].iter().nth(3);
371     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
372
373 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
374    --> $DIR/methods.rs:316:31
375     |
376 316 |         let bad_boxed_slice = boxed_slice.iter().nth(3);
377     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^
378
379 error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
380    --> $DIR/methods.rs:317:29
381     |
382 317 |         let bad_vec_deque = some_vec_deque.iter().nth(3);
383     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
384
385 error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
386    --> $DIR/methods.rs:322:23
387     |
388 322 |         let bad_vec = some_vec.iter_mut().nth(3);
389     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
390
391 error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
392    --> $DIR/methods.rs:325:26
393     |
394 325 |         let bad_slice = &some_vec[..].iter_mut().nth(3);
395     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
396
397 error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
398    --> $DIR/methods.rs:328:29
399     |
400 328 |         let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
401     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
402
403 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
404    --> $DIR/methods.rs:340:13
405     |
406 340 |     let _ = some_vec.iter().skip(42).next();
407     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
408     |
409     = note: `-D iter-skip-next` implied by `-D warnings`
410
411 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
412    --> $DIR/methods.rs:341:13
413     |
414 341 |     let _ = some_vec.iter().cycle().skip(42).next();
415     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
416
417 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
418    --> $DIR/methods.rs:342:13
419     |
420 342 |     let _ = (1..10).skip(10).next();
421     |             ^^^^^^^^^^^^^^^^^^^^^^^
422
423 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
424    --> $DIR/methods.rs:343:14
425     |
426 343 |     let _ = &some_vec[..].iter().skip(3).next();
427     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
428
429 error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
430    --> $DIR/methods.rs:369:17
431     |
432 369 |         let _ = boxed_slice.get(1).unwrap();
433     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
434     |
435     = note: `-D get-unwrap` implied by `-D warnings`
436
437 error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
438    --> $DIR/methods.rs:370:17
439     |
440 370 |         let _ = some_slice.get(0).unwrap();
441     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]`
442
443 error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
444    --> $DIR/methods.rs:371:17
445     |
446 371 |         let _ = some_vec.get(0).unwrap();
447     |                 ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]`
448
449 error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
450    --> $DIR/methods.rs:372:17
451     |
452 372 |         let _ = some_vecdeque.get(0).unwrap();
453     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]`
454
455 error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
456    --> $DIR/methods.rs:373:17
457     |
458 373 |         let _ = some_hashmap.get(&1).unwrap();
459     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]`
460
461 error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
462    --> $DIR/methods.rs:374:17
463     |
464 374 |         let _ = some_btreemap.get(&1).unwrap();
465     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]`
466
467 error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
468    --> $DIR/methods.rs:379:10
469     |
470 379 |         *boxed_slice.get_mut(0).unwrap() = 1;
471     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut boxed_slice[0]`
472
473 error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
474    --> $DIR/methods.rs:380:10
475     |
476 380 |         *some_slice.get_mut(0).unwrap() = 1;
477     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_slice[0]`
478
479 error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
480    --> $DIR/methods.rs:381:10
481     |
482 381 |         *some_vec.get_mut(0).unwrap() = 1;
483     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vec[0]`
484
485 error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
486    --> $DIR/methods.rs:382:10
487     |
488 382 |         *some_vecdeque.get_mut(0).unwrap() = 1;
489     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&mut some_vecdeque[0]`
490
491 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
492    --> $DIR/methods.rs:396:13
493     |
494 396 |     let _ = opt.unwrap();
495     |             ^^^^^^^^^^^^
496     |
497     = note: `-D option-unwrap-used` implied by `-D warnings`
498
499 error: used unwrap() on a Result value. If you don't want to handle the Err case gracefully, consider using expect() to provide a better panic message
500    --> $DIR/methods.rs:399:13
501     |
502 399 |     let _ = res.unwrap();
503     |             ^^^^^^^^^^^^
504     |
505     = note: `-D result-unwrap-used` implied by `-D warnings`
506
507 error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`
508    --> $DIR/methods.rs:401:5
509     |
510 401 |     res.ok().expect("disaster!");
511     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
512     |
513     = note: `-D ok-expect` implied by `-D warnings`
514
515 error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`
516    --> $DIR/methods.rs:407:5
517     |
518 407 |     res3.ok().expect("whoof");
519     |     ^^^^^^^^^^^^^^^^^^^^^^^^^
520
521 error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`
522    --> $DIR/methods.rs:409:5
523     |
524 409 |     res4.ok().expect("argh");
525     |     ^^^^^^^^^^^^^^^^^^^^^^^^
526
527 error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`
528    --> $DIR/methods.rs:411:5
529     |
530 411 |     res5.ok().expect("oops");
531     |     ^^^^^^^^^^^^^^^^^^^^^^^^
532
533 error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`
534    --> $DIR/methods.rs:413:5
535     |
536 413 |     res6.ok().expect("meh");
537     |     ^^^^^^^^^^^^^^^^^^^^^^^
538
539 error: you should use the `starts_with` method
540    --> $DIR/methods.rs:425:5
541     |
542 425 |     "".chars().next() == Some(' ');
543     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with(' ')`
544     |
545     = note: `-D chars-next-cmp` implied by `-D warnings`
546
547 error: you should use the `starts_with` method
548    --> $DIR/methods.rs:426:5
549     |
550 426 |     Some(' ') != "".chars().next();
551     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with(' ')`
552
553 error: calling `.extend(_.chars())`
554    --> $DIR/methods.rs:435:5
555     |
556 435 |     s.extend(abc.chars());
557     |     ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)`
558     |
559     = note: `-D string-extend-chars` implied by `-D warnings`
560
561 error: calling `.extend(_.chars())`
562    --> $DIR/methods.rs:438:5
563     |
564 438 |     s.extend("abc".chars());
565     |     ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")`
566
567 error: calling `.extend(_.chars())`
568    --> $DIR/methods.rs:441:5
569     |
570 441 |     s.extend(def.chars());
571     |     ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)`
572
573 error: using `clone` on a `Copy` type
574    --> $DIR/methods.rs:452:5
575     |
576 452 |     42.clone();
577     |     ^^^^^^^^^^ help: try removing the `clone` call: `42`
578     |
579     = note: `-D clone-on-copy` implied by `-D warnings`
580
581 error: using `clone` on a `Copy` type
582    --> $DIR/methods.rs:456:5
583     |
584 456 |     (&42).clone();
585     |     ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
586
587 error: using `clone` on a `Copy` type
588    --> $DIR/methods.rs:460:5
589     |
590 460 |     t.clone();
591     |     ^^^^^^^^^ help: try removing the `clone` call: `t`
592
593 error: using `clone` on a `Copy` type
594    --> $DIR/methods.rs:462:5
595     |
596 462 |     Some(t).clone();
597     |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
598
599 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
600    --> $DIR/methods.rs:468:22
601     |
602 468 |     let z: &Vec<_> = y.clone();
603     |                      ^^^^^^^^^ help: try dereferencing it: `(*y).clone()`
604     |
605     = note: `-D clone-double-ref` implied by `-D warnings`
606
607 error: single-character string constant used as pattern
608    --> $DIR/methods.rs:475:13
609     |
610 475 |     x.split("x");
611     |     --------^^^- help: try using a char instead: `x.split('x')`
612     |
613     = note: `-D single-char-pattern` implied by `-D warnings`
614
615 error: single-character string constant used as pattern
616    --> $DIR/methods.rs:492:16
617     |
618 492 |     x.contains("x");
619     |     -----------^^^- help: try using a char instead: `x.contains('x')`
620
621 error: single-character string constant used as pattern
622    --> $DIR/methods.rs:493:19
623     |
624 493 |     x.starts_with("x");
625     |     --------------^^^- help: try using a char instead: `x.starts_with('x')`
626
627 error: single-character string constant used as pattern
628    --> $DIR/methods.rs:494:17
629     |
630 494 |     x.ends_with("x");
631     |     ------------^^^- help: try using a char instead: `x.ends_with('x')`
632
633 error: single-character string constant used as pattern
634    --> $DIR/methods.rs:495:12
635     |
636 495 |     x.find("x");
637     |     -------^^^- help: try using a char instead: `x.find('x')`
638
639 error: single-character string constant used as pattern
640    --> $DIR/methods.rs:496:13
641     |
642 496 |     x.rfind("x");
643     |     --------^^^- help: try using a char instead: `x.rfind('x')`
644
645 error: single-character string constant used as pattern
646    --> $DIR/methods.rs:497:14
647     |
648 497 |     x.rsplit("x");
649     |     ---------^^^- help: try using a char instead: `x.rsplit('x')`
650
651 error: single-character string constant used as pattern
652    --> $DIR/methods.rs:498:24
653     |
654 498 |     x.split_terminator("x");
655     |     -------------------^^^- help: try using a char instead: `x.split_terminator('x')`
656
657 error: single-character string constant used as pattern
658    --> $DIR/methods.rs:499:25
659     |
660 499 |     x.rsplit_terminator("x");
661     |     --------------------^^^- help: try using a char instead: `x.rsplit_terminator('x')`
662
663 error: single-character string constant used as pattern
664    --> $DIR/methods.rs:500:17
665     |
666 500 |     x.splitn(0, "x");
667     |     ------------^^^- help: try using a char instead: `x.splitn(0, 'x')`
668
669 error: single-character string constant used as pattern
670    --> $DIR/methods.rs:501:18
671     |
672 501 |     x.rsplitn(0, "x");
673     |     -------------^^^- help: try using a char instead: `x.rsplitn(0, 'x')`
674
675 error: single-character string constant used as pattern
676    --> $DIR/methods.rs:502:15
677     |
678 502 |     x.matches("x");
679     |     ----------^^^- help: try using a char instead: `x.matches('x')`
680
681 error: single-character string constant used as pattern
682    --> $DIR/methods.rs:503:16
683     |
684 503 |     x.rmatches("x");
685     |     -----------^^^- help: try using a char instead: `x.rmatches('x')`
686
687 error: single-character string constant used as pattern
688    --> $DIR/methods.rs:504:21
689     |
690 504 |     x.match_indices("x");
691     |     ----------------^^^- help: try using a char instead: `x.match_indices('x')`
692
693 error: single-character string constant used as pattern
694    --> $DIR/methods.rs:505:22
695     |
696 505 |     x.rmatch_indices("x");
697     |     -----------------^^^- help: try using a char instead: `x.rmatch_indices('x')`
698
699 error: single-character string constant used as pattern
700    --> $DIR/methods.rs:506:25
701     |
702 506 |     x.trim_left_matches("x");
703     |     --------------------^^^- help: try using a char instead: `x.trim_left_matches('x')`
704
705 error: single-character string constant used as pattern
706    --> $DIR/methods.rs:507:26
707     |
708 507 |     x.trim_right_matches("x");
709     |     ---------------------^^^- help: try using a char instead: `x.trim_right_matches('x')`
710
711 error: you are getting the inner pointer of a temporary `CString`
712    --> $DIR/methods.rs:517:5
713     |
714 517 |     CString::new("foo").unwrap().as_ptr();
715     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
716     |
717     = note: `-D temporary-cstring-as-ptr` implied by `-D warnings`
718     = note: that pointer will be invalid outside this expression
719 help: assign the `CString` to a variable to extend its lifetime
720    --> $DIR/methods.rs:517:5
721     |
722 517 |     CString::new("foo").unwrap().as_ptr();
723     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
724
725 error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
726    --> $DIR/methods.rs:522:27
727     |
728 522 |     let v2 : Vec<isize> = v.iter().cloned().collect();
729     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
730     |
731     = note: `-D iter-cloned-collect` implied by `-D warnings`
732
733 error: aborting due to 106 previous errors
734