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