]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | error: redundant closure |
2 | --> $DIR/eta.rs:32:27 | |
3 | | | |
4 | LL | let a = Some(1u8).map(|a| foo(a)); | |
5 | | ^^^^^^^^^^ help: replace the closure with the function itself: `foo` | |
6 | | | |
7 | = note: `-D clippy::redundant-closure` implied by `-D warnings` | |
8 | ||
9 | error: redundant closure | |
10 | --> $DIR/eta.rs:33:10 | |
11 | | | |
12 | LL | meta(|a| foo(a)); | |
13 | | ^^^^^^^^^^ help: replace the closure with the function itself: `foo` | |
14 | ||
15 | error: redundant closure | |
16 | --> $DIR/eta.rs:37:40 | |
17 | | | |
18 | LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec! | |
19 | | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new` | |
20 | ||
21 | error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler | |
22 | --> $DIR/eta.rs:39: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 | |
30 | --> $DIR/eta.rs:46:27 | |
31 | | | |
32 | LL | let e = Some(1u8).map(|a| generic(a)); | |
33 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic` | |
34 | ||
35 | error: redundant closure | |
17df50a5 | 36 | --> $DIR/eta.rs:92:51 |
f20569fa XL |
37 | | |
38 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo()); | |
39 | | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo` | |
40 | | | |
41 | = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings` | |
42 | ||
43 | error: redundant closure | |
17df50a5 | 44 | --> $DIR/eta.rs:94:51 |
f20569fa XL |
45 | | |
46 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo()); | |
47 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo` | |
48 | ||
49 | error: redundant closure | |
17df50a5 | 50 | --> $DIR/eta.rs:97:42 |
f20569fa XL |
51 | | |
52 | LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear()); | |
53 | | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear` | |
54 | ||
55 | error: redundant closure | |
17df50a5 | 56 | --> $DIR/eta.rs:102:29 |
f20569fa XL |
57 | | |
58 | LL | let e = Some("str").map(|s| s.to_string()); | |
59 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string` | |
60 | ||
61 | error: redundant closure | |
17df50a5 | 62 | --> $DIR/eta.rs:104:27 |
f20569fa XL |
63 | | |
64 | LL | let e = Some('a').map(|s| s.to_uppercase()); | |
65 | | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase` | |
66 | ||
67 | error: redundant closure | |
17df50a5 | 68 | --> $DIR/eta.rs:107:65 |
f20569fa XL |
69 | | |
70 | LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect(); | |
71 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase` | |
72 | ||
73 | error: redundant closure | |
17df50a5 | 74 | --> $DIR/eta.rs:190:27 |
f20569fa XL |
75 | | |
76 | LL | let a = Some(1u8).map(|a| foo_ptr(a)); | |
77 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr` | |
78 | ||
79 | error: redundant closure | |
17df50a5 | 80 | --> $DIR/eta.rs:195:27 |
f20569fa XL |
81 | | |
82 | LL | let a = Some(1u8).map(|a| closure(a)); | |
83 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure` | |
84 | ||
136023e0 XL |
85 | error: redundant closure |
86 | --> $DIR/eta.rs:227:28 | |
87 | | | |
88 | LL | x.into_iter().for_each(|x| add_to_res(x)); | |
89 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` | |
90 | ||
91 | error: redundant closure | |
92 | --> $DIR/eta.rs:228:28 | |
93 | | | |
94 | LL | y.into_iter().for_each(|x| add_to_res(x)); | |
95 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` | |
96 | ||
97 | error: redundant closure | |
98 | --> $DIR/eta.rs:229:28 | |
99 | | | |
100 | LL | z.into_iter().for_each(|x| add_to_res(x)); | |
101 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res` | |
102 | ||
103 | error: redundant closure | |
104 | --> $DIR/eta.rs:236:21 | |
105 | | | |
106 | LL | Some(1).map(|n| closure(n)); | |
107 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure` | |
108 | ||
109 | error: aborting due to 17 previous errors | |
f20569fa | 110 |