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: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
24 LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
25 | ^^^ help: change this to: `&2`
27 = note: `-D clippy::needless-borrow` implied by `-D warnings`
29 error: redundant closure
32 LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
33 | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
35 error: redundant closure
38 LL | let e = Some(1u8).map(|a| divergent(a));
39 | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
41 error: redundant closure
44 LL | let e = Some(1u8).map(|a| generic(a));
45 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
47 error: redundant closure
50 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
51 | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
53 = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
55 error: redundant closure
58 LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
59 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
61 error: redundant closure
64 LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
65 | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
67 error: redundant closure
70 LL | let e = Some("str").map(|s| s.to_string());
71 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
73 error: redundant closure
76 LL | let e = Some('a').map(|s| s.to_uppercase());
77 | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
79 error: redundant closure
80 --> $DIR/eta.rs:101:65
82 LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
85 error: redundant closure
86 --> $DIR/eta.rs:164:22
88 LL | requires_fn_once(|| x());
89 | ^^^^^^ help: replace the closure with the function itself: `x`
91 error: redundant closure
92 --> $DIR/eta.rs:171:27
94 LL | let a = Some(1u8).map(|a| foo_ptr(a));
95 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
97 error: redundant closure
98 --> $DIR/eta.rs:176:27
100 LL | let a = Some(1u8).map(|a| closure(a));
101 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
103 error: redundant closure
104 --> $DIR/eta.rs:208:28
106 LL | x.into_iter().for_each(|x| add_to_res(x));
107 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
109 error: redundant closure
110 --> $DIR/eta.rs:209:28
112 LL | y.into_iter().for_each(|x| add_to_res(x));
113 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
115 error: redundant closure
116 --> $DIR/eta.rs:210:28
118 LL | z.into_iter().for_each(|x| add_to_res(x));
119 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
121 error: redundant closure
122 --> $DIR/eta.rs:217:21
124 LL | Some(1).map(|n| closure(n));
125 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
127 error: redundant closure
128 --> $DIR/eta.rs:236:21
130 LL | map_str_to_path(|s| s.as_ref());
131 | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`
133 error: aborting due to 21 previous errors