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| divergent(a));
31 | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
33 error: redundant closure
36 LL | let e = Some(1u8).map(|a| generic(a));
37 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
39 error: redundant closure
42 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
43 | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
45 = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
47 error: redundant closure
50 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
51 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
53 error: redundant closure
56 LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
57 | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
59 error: redundant closure
62 LL | let e = Some("str").map(|s| s.to_string());
63 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
65 error: redundant closure
68 LL | let e = Some('a').map(|s| s.to_uppercase());
69 | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
71 error: redundant closure
74 LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
75 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
77 error: redundant closure
78 --> $DIR/eta.rs:160:22
80 LL | requires_fn_once(|| x());
81 | ^^^^^^ help: replace the closure with the function itself: `x`
83 error: redundant closure
84 --> $DIR/eta.rs:167:27
86 LL | let a = Some(1u8).map(|a| foo_ptr(a));
87 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
89 error: redundant closure
90 --> $DIR/eta.rs:172:27
92 LL | let a = Some(1u8).map(|a| closure(a));
93 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
95 error: redundant closure
96 --> $DIR/eta.rs:204:28
98 LL | x.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:205:28
104 LL | y.into_iter().for_each(|x| add_to_res(x));
105 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
107 error: redundant closure
108 --> $DIR/eta.rs:206:28
110 LL | z.into_iter().for_each(|x| add_to_res(x));
111 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
113 error: redundant closure
114 --> $DIR/eta.rs:213:21
116 LL | Some(1).map(|n| closure(n));
117 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
119 error: redundant closure
120 --> $DIR/eta.rs:232:21
122 LL | map_str_to_path(|s| s.as_ref());
123 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`
125 error: aborting due to 20 previous errors