1 error: redundant closure
4 LL | let a = Some(1u8).map(|a| foo(a));
5 | ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
7 = note: `-D clippy::redundant-closure` implied by `-D warnings`
9 error: redundant closure
12 LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
13 | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
15 error: redundant closure
18 LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
19 | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
21 error: redundant closure
24 LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
25 | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
27 error: redundant closure
30 LL | let e = Some(1u8).map(|a| generic(a));
31 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
33 error: redundant closure
36 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
37 | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
39 = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
41 error: redundant closure
44 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
45 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
47 error: redundant closure
50 LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
51 | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
53 error: redundant closure
56 LL | let e = Some("str").map(|s| s.to_string());
57 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
59 error: redundant closure
62 LL | let e = Some('a').map(|s| s.to_uppercase());
63 | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
65 error: redundant closure
68 LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
71 error: redundant closure
72 --> $DIR/eta.rs:160:22
74 LL | requires_fn_once(|| x());
75 | ^^^^^^ help: replace the closure with the function itself: `x`
77 error: redundant closure
78 --> $DIR/eta.rs:167:27
80 LL | let a = Some(1u8).map(|a| foo_ptr(a));
81 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
83 error: redundant closure
84 --> $DIR/eta.rs:172:27
86 LL | let a = Some(1u8).map(|a| closure(a));
87 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
89 error: redundant closure
90 --> $DIR/eta.rs:204:28
92 LL | x.into_iter().for_each(|x| add_to_res(x));
93 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
95 error: redundant closure
96 --> $DIR/eta.rs:205:28
98 LL | y.into_iter().for_each(|x| add_to_res(x));
99 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
101 error: redundant closure
102 --> $DIR/eta.rs:206:28
104 LL | z.into_iter().for_each(|x| add_to_res(x));
105 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
107 error: redundant closure
108 --> $DIR/eta.rs:213:21
110 LL | Some(1).map(|n| closure(n));
111 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
113 error: redundant closure
114 --> $DIR/eta.rs:217:21
116 LL | Some(1).map(|n| in_loop(n));
117 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
119 error: redundant closure
120 --> $DIR/eta.rs:310:18
122 LL | takes_fn_mut(|| f());
123 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
125 error: redundant closure
126 --> $DIR/eta.rs:313:19
128 LL | takes_fn_once(|| f());
129 | ^^^^^^ help: replace the closure with the function itself: `&mut f`
131 error: redundant closure
132 --> $DIR/eta.rs:317:26
134 LL | move || takes_fn_mut(|| f_used_once())
135 | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
137 error: aborting due to 22 previous errors