]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods.stderr
Merge pull request #2126 from camsteffen/split-tests
[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(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
146    --> $DIR/methods.rs:114:13
147     |
148 114 |       let _ = opt.map(|x| {
149     |  _____________^
150 115 | |         Some(x + 1)
151 116 | |     }
152 117 | |     ).unwrap_or(None);
153     | |_____________________^
154
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
157     |
158 118 |       let _ = opt
159     |  _____________^
160 119 | |         .map(|x| Some(x + 1))
161 120 | |         .unwrap_or(None);
162     | |________________________^
163     |
164     = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
165
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
168     |
169 126 |       let _ = opt.map(|x| x + 1)
170     |  _____________^
171 127 | |
172 128 | |                .unwrap_or_else(|| 0); // should lint even though this call is on a separate line
173     | |____________________________________^
174     |
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)`
177
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
180     |
181 130 |       let _ = opt.map(|x| {
182     |  _____________^
183 131 | |                         x + 1
184 132 | |                     }
185 133 | |               ).unwrap_or_else(|| 0);
186     | |____________________________________^
187
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
190     |
191 134 |       let _ = opt.map(|x| x + 1)
192     |  _____________^
193 135 | |                .unwrap_or_else(||
194 136 | |                     0
195 137 | |                 );
196     | |_________________^
197
198 error: unnecessary structure name repetition
199    --> $DIR/methods.rs:163:24
200     |
201 163 |     fn filter(self) -> IteratorFalsePositives {
202     |                        ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
203
204 error: unnecessary structure name repetition
205    --> $DIR/methods.rs:167:22
206     |
207 167 |     fn next(self) -> IteratorFalsePositives {
208     |                      ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
209
210 error: unnecessary structure name repetition
211    --> $DIR/methods.rs:187:32
212     |
213 187 |     fn skip(self, _: usize) -> IteratorFalsePositives {
214     |                                ^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
215
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
218     |
219 197 |     let _ = v.iter().filter(|&x| *x < 0).next();
220     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221     |
222     = note: `-D filter-next` implied by `-D warnings`
223     = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
224
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
227     |
228 200 |       let _ = v.iter().filter(|&x| {
229     |  _____________^
230 201 | |                                 *x < 0
231 202 | |                             }
232 203 | |                    ).next();
233     | |___________________________^
234
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
237     |
238 215 |     let _ = v.iter().find(|&x| *x < 0).is_some();
239     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
240     |
241     = note: `-D search-is-some` implied by `-D warnings`
242     = note: replace `find(|&x| *x < 0).is_some()` with `any(|&x| *x < 0)`
243
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
246     |
247 218 |       let _ = v.iter().find(|&x| {
248     |  _____________^
249 219 | |                               *x < 0
250 220 | |                           }
251 221 | |                    ).is_some();
252     | |______________________________^
253
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
256     |
257 224 |     let _ = v.iter().position(|&x| x < 0).is_some();
258     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
259     |
260     = note: replace `position(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
261
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
264     |
265 227 |       let _ = v.iter().position(|&x| {
266     |  _____________^
267 228 | |                                   x < 0
268 229 | |                               }
269 230 | |                    ).is_some();
270     | |______________________________^
271
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
274     |
275 233 |     let _ = v.iter().rposition(|&x| x < 0).is_some();
276     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
277     |
278     = note: replace `rposition(|&x| x < 0).is_some()` with `any(|&x| x < 0)`
279
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
282     |
283 236 |       let _ = v.iter().rposition(|&x| {
284     |  _____________^
285 237 | |                                    x < 0
286 238 | |                                }
287 239 | |                    ).is_some();
288     | |______________________________^
289
290 error: unnecessary structure name repetition
291    --> $DIR/methods.rs:253:21
292     |
293 253 |         fn new() -> Foo { Foo }
294     |                     ^^^ help: use the applicable keyword: `Self`
295
296 error: use of `unwrap_or` followed by a function call
297    --> $DIR/methods.rs:271:5
298     |
299 271 |     with_constructor.unwrap_or(make());
300     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_constructor.unwrap_or_else(make)`
301     |
302     = note: `-D or-fun-call` implied by `-D warnings`
303
304 error: use of `unwrap_or` followed by a call to `new`
305    --> $DIR/methods.rs:274:5
306     |
307 274 |     with_new.unwrap_or(Vec::new());
308     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_new.unwrap_or_default()`
309
310 error: use of `unwrap_or` followed by a function call
311    --> $DIR/methods.rs:277:5
312     |
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))`
315
316 error: use of `unwrap_or` followed by a function call
317    --> $DIR/methods.rs:280:5
318     |
319 280 |     with_err.unwrap_or(make());
320     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_err.unwrap_or_else(|_| make())`
321
322 error: use of `unwrap_or` followed by a function call
323    --> $DIR/methods.rs:283:5
324     |
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))`
327
328 error: use of `unwrap_or` followed by a call to `default`
329    --> $DIR/methods.rs:286:5
330     |
331 286 |     with_default_trait.unwrap_or(Default::default());
332     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_trait.unwrap_or_default()`
333
334 error: use of `unwrap_or` followed by a call to `default`
335    --> $DIR/methods.rs:289:5
336     |
337 289 |     with_default_type.unwrap_or(u64::default());
338     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_default_type.unwrap_or_default()`
339
340 error: use of `unwrap_or` followed by a function call
341    --> $DIR/methods.rs:292:5
342     |
343 292 |     with_vec.unwrap_or(vec![]);
344     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `with_vec.unwrap_or_else(|| < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ))`
345
346 error: use of `unwrap_or` followed by a function call
347    --> $DIR/methods.rs:297:5
348     |
349 297 |     without_default.unwrap_or(Foo::new());
350     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `without_default.unwrap_or_else(Foo::new)`
351
352 error: use of `or_insert` followed by a function call
353    --> $DIR/methods.rs:300:5
354     |
355 300 |     map.entry(42).or_insert(String::new());
356     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `map.entry(42).or_insert_with(String::new)`
357
358 error: use of `or_insert` followed by a function call
359    --> $DIR/methods.rs:303:5
360     |
361 303 |     btree.entry(42).or_insert(String::new());
362     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `btree.entry(42).or_insert_with(String::new)`
363
364 error: use of `unwrap_or` followed by a function call
365    --> $DIR/methods.rs:306:13
366     |
367 306 |     let _ = stringy.unwrap_or("".to_owned());
368     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `stringy.unwrap_or_else(|| "".to_owned())`
369
370 error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable
371    --> $DIR/methods.rs:317:23
372     |
373 317 |         let bad_vec = some_vec.iter().nth(3);
374     |                       ^^^^^^^^^^^^^^^^^^^^^^
375     |
376     = note: `-D iter-nth` implied by `-D warnings`
377
378 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
379    --> $DIR/methods.rs:318:26
380     |
381 318 |         let bad_slice = &some_vec[..].iter().nth(3);
382     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
383
384 error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable
385    --> $DIR/methods.rs:319:31
386     |
387 319 |         let bad_boxed_slice = boxed_slice.iter().nth(3);
388     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^
389
390 error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable
391    --> $DIR/methods.rs:320:29
392     |
393 320 |         let bad_vec_deque = some_vec_deque.iter().nth(3);
394     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
395
396 error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable
397    --> $DIR/methods.rs:325:23
398     |
399 325 |         let bad_vec = some_vec.iter_mut().nth(3);
400     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
401
402 error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable
403    --> $DIR/methods.rs:328:26
404     |
405 328 |         let bad_slice = &some_vec[..].iter_mut().nth(3);
406     |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
407
408 error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable
409    --> $DIR/methods.rs:331:29
410     |
411 331 |         let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
412     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
413
414 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
415    --> $DIR/methods.rs:343:13
416     |
417 343 |     let _ = some_vec.iter().skip(42).next();
418     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
419     |
420     = note: `-D iter-skip-next` implied by `-D warnings`
421
422 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
423    --> $DIR/methods.rs:344:13
424     |
425 344 |     let _ = some_vec.iter().cycle().skip(42).next();
426     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
427
428 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
429    --> $DIR/methods.rs:345:13
430     |
431 345 |     let _ = (1..10).skip(10).next();
432     |             ^^^^^^^^^^^^^^^^^^^^^^^
433
434 error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
435    --> $DIR/methods.rs:346:14
436     |
437 346 |     let _ = &some_vec[..].iter().skip(3).next();
438     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
439
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
442     |
443 355 |     let _ = opt.unwrap();
444     |             ^^^^^^^^^^^^
445     |
446     = note: `-D option-unwrap-used` implied by `-D warnings`
447