]> git.lizzy.rs Git - rust.git/blob - tests/ui/eta.stderr
redundant closure implemented for closures containing method calls
[rust.git] / tests / ui / eta.stderr
1 error: redundant closure found
2   --> $DIR/eta.rs:15:27
3    |
4 LL |     let a = Some(1u8).map(|a| foo(a));
5    |                           ^^^^^^^^^^ help: remove closure as shown: `foo`
6    |
7    = note: `-D clippy::redundant-closure` implied by `-D warnings`
8
9 error: redundant closure found
10   --> $DIR/eta.rs:16:10
11    |
12 LL |     meta(|a| foo(a));
13    |          ^^^^^^^^^^ help: remove closure as shown: `foo`
14
15 error: redundant closure found
16   --> $DIR/eta.rs:17:27
17    |
18 LL |     let c = Some(1u8).map(|a| {1+2; foo}(a));
19    |                           ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `{1+2; foo}`
20
21 error: this expression borrows a reference that is immediately dereferenced by the compiler
22   --> $DIR/eta.rs:19:21
23    |
24 LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
25    |                     ^^^ help: change this to: `&2`
26    |
27    = note: `-D clippy::needless-borrow` implied by `-D warnings`
28
29 error: redundant closure found
30   --> $DIR/eta.rs:26:27
31    |
32 LL |     let e = Some(1u8).map(|a| generic(a));
33    |                           ^^^^^^^^^^^^^^ help: remove closure as shown: `generic`
34
35 error: redundant closure found
36   --> $DIR/eta.rs:60:48
37    |
38 LL |     let e = Some(TestStruct{some_ref: &i}).map(|a| a.foo());
39    |                                                ^^^^^^^^^^^ help: remove closure as shown: `TestStruct::foo`
40
41 error: redundant closure found
42   --> $DIR/eta.rs:62:48
43    |
44 LL |     let e = Some(TestStruct{some_ref: &i}).map(|a| a.trait_foo());
45    |                                                ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `TestTrait::trait_foo`
46
47 error: redundant closure found
48   --> $DIR/eta.rs:65:40
49    |
50 LL |     let e = Some(&mut vec!(1,2,3)).map(|v| v.clear());
51    |                                        ^^^^^^^^^^^^^ help: remove closure as shown: `std::vec::Vec::clear`
52
53 error: redundant closure found
54   --> $DIR/eta.rs:70:29
55    |
56 LL |     let e = Some("str").map(|s| s.to_string());
57    |                             ^^^^^^^^^^^^^^^^^ help: remove closure as shown: `std::string::ToString::to_string`
58
59 error: redundant closure found
60   --> $DIR/eta.rs:72:27
61    |
62 LL |     let e = Some('a').map(|s| s.to_uppercase());
63    |                           ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_uppercase`
64
65 error: redundant closure found
66   --> $DIR/eta.rs:75:63
67    |
68 LL |     let e: std::vec::Vec<char> = vec!('a','b','c').iter().map(|c| c.to_ascii_uppercase()).collect();
69    |                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `char::to_ascii_uppercase`
70
71 error: aborting due to 11 previous errors
72