|
1 | 1 | error: redundant closure
|
2 |
| - --> $DIR/eta.rs:29:27 |
| 2 | + --> $DIR/eta.rs:28:27 |
3 | 3 | |
|
4 | 4 | LL | let a = Some(1u8).map(|a| foo(a));
|
5 | 5 | | ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::redundant-closure` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: redundant closure
|
10 |
| - --> $DIR/eta.rs:33:40 |
| 10 | + --> $DIR/eta.rs:32:40 |
11 | 11 | |
|
12 | 12 | LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
|
13 | 13 | | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
|
14 | 14 |
|
15 | 15 | error: redundant closure
|
16 |
| - --> $DIR/eta.rs:34:35 |
| 16 | + --> $DIR/eta.rs:33:35 |
17 | 17 | |
|
18 | 18 | LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
|
19 | 19 | | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
|
20 | 20 |
|
21 | 21 | error: redundant closure
|
22 |
| - --> $DIR/eta.rs:35:26 |
| 22 | + --> $DIR/eta.rs:34:26 |
23 | 23 | |
|
24 | 24 | LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
25 | 25 | | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
|
26 | 26 |
|
27 | 27 | error: redundant closure
|
28 |
| - --> $DIR/eta.rs:42:27 |
| 28 | + --> $DIR/eta.rs:41:27 |
29 | 29 | |
|
30 | 30 | LL | let e = Some(1u8).map(|a| generic(a));
|
31 | 31 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
|
32 | 32 |
|
33 | 33 | error: redundant closure
|
34 |
| - --> $DIR/eta.rs:88:51 |
| 34 | + --> $DIR/eta.rs:87:51 |
35 | 35 | |
|
36 | 36 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
37 | 37 | | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
|
38 | 38 | |
|
39 | 39 | = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
|
40 | 40 |
|
41 | 41 | error: redundant closure
|
42 |
| - --> $DIR/eta.rs:89:51 |
| 42 | + --> $DIR/eta.rs:88:51 |
43 | 43 | |
|
44 | 44 | LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
|
45 | 45 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
|
46 | 46 |
|
47 | 47 | error: redundant closure
|
48 |
| - --> $DIR/eta.rs:91:42 |
| 48 | + --> $DIR/eta.rs:90:42 |
49 | 49 | |
|
50 | 50 | LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
|
51 | 51 | | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
|
52 | 52 |
|
53 | 53 | error: redundant closure
|
54 |
| - --> $DIR/eta.rs:95:29 |
| 54 | + --> $DIR/eta.rs:94:29 |
55 | 55 | |
|
56 | 56 | LL | let e = Some("str").map(|s| s.to_string());
|
57 | 57 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
|
58 | 58 |
|
59 | 59 | error: redundant closure
|
60 |
| - --> $DIR/eta.rs:96:27 |
| 60 | + --> $DIR/eta.rs:95:27 |
61 | 61 | |
|
62 | 62 | LL | let e = Some('a').map(|s| s.to_uppercase());
|
63 | 63 | | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
|
64 | 64 |
|
65 | 65 | error: redundant closure
|
66 |
| - --> $DIR/eta.rs:98:65 |
| 66 | + --> $DIR/eta.rs:97:65 |
67 | 67 | |
|
68 | 68 | LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
|
69 | 69 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
|
70 | 70 |
|
71 | 71 | error: redundant closure
|
72 |
| - --> $DIR/eta.rs:161:22 |
| 72 | + --> $DIR/eta.rs:160:22 |
73 | 73 | |
|
74 | 74 | LL | requires_fn_once(|| x());
|
75 | 75 | | ^^^^^^ help: replace the closure with the function itself: `x`
|
76 | 76 |
|
77 | 77 | error: redundant closure
|
78 |
| - --> $DIR/eta.rs:168:27 |
| 78 | + --> $DIR/eta.rs:167:27 |
79 | 79 | |
|
80 | 80 | LL | let a = Some(1u8).map(|a| foo_ptr(a));
|
81 | 81 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
|
82 | 82 |
|
83 | 83 | error: redundant closure
|
84 |
| - --> $DIR/eta.rs:173:27 |
| 84 | + --> $DIR/eta.rs:172:27 |
85 | 85 | |
|
86 | 86 | LL | let a = Some(1u8).map(|a| closure(a));
|
87 | 87 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
|
88 | 88 |
|
89 | 89 | error: redundant closure
|
90 |
| - --> $DIR/eta.rs:205:28 |
| 90 | + --> $DIR/eta.rs:204:28 |
91 | 91 | |
|
92 | 92 | LL | x.into_iter().for_each(|x| add_to_res(x));
|
93 | 93 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
94 | 94 |
|
95 | 95 | error: redundant closure
|
96 |
| - --> $DIR/eta.rs:206:28 |
| 96 | + --> $DIR/eta.rs:205:28 |
97 | 97 | |
|
98 | 98 | LL | y.into_iter().for_each(|x| add_to_res(x));
|
99 | 99 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
100 | 100 |
|
101 | 101 | error: redundant closure
|
102 |
| - --> $DIR/eta.rs:207:28 |
| 102 | + --> $DIR/eta.rs:206:28 |
103 | 103 | |
|
104 | 104 | LL | z.into_iter().for_each(|x| add_to_res(x));
|
105 | 105 | | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
|
106 | 106 |
|
107 | 107 | error: redundant closure
|
108 |
| - --> $DIR/eta.rs:214:21 |
| 108 | + --> $DIR/eta.rs:213:21 |
109 | 109 | |
|
110 | 110 | LL | Some(1).map(|n| closure(n));
|
111 | 111 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
|
112 | 112 |
|
113 | 113 | error: redundant closure
|
114 |
| - --> $DIR/eta.rs:218:21 |
| 114 | + --> $DIR/eta.rs:217:21 |
115 | 115 | |
|
116 | 116 | LL | Some(1).map(|n| in_loop(n));
|
117 | 117 | | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
|
118 | 118 |
|
119 | 119 | error: redundant closure
|
120 |
| - --> $DIR/eta.rs:311:18 |
| 120 | + --> $DIR/eta.rs:310:18 |
121 | 121 | |
|
122 | 122 | LL | takes_fn_mut(|| f());
|
123 | 123 | | ^^^^^^ help: replace the closure with the function itself: `&mut f`
|
124 | 124 |
|
125 | 125 | error: redundant closure
|
126 |
| - --> $DIR/eta.rs:314:19 |
| 126 | + --> $DIR/eta.rs:313:19 |
127 | 127 | |
|
128 | 128 | LL | takes_fn_once(|| f());
|
129 | 129 | | ^^^^^^ help: replace the closure with the function itself: `&mut f`
|
130 | 130 |
|
131 | 131 | error: redundant closure
|
132 |
| - --> $DIR/eta.rs:318:26 |
| 132 | + --> $DIR/eta.rs:317:26 |
133 | 133 | |
|
134 | 134 | LL | move || takes_fn_mut(|| f_used_once())
|
135 | 135 | | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
|
136 | 136 |
|
137 | 137 | error: redundant closure
|
138 |
| - --> $DIR/eta.rs:330:19 |
| 138 | + --> $DIR/eta.rs:329:19 |
139 | 139 | |
|
140 | 140 | LL | array_opt.map(|a| a.as_slice());
|
141 | 141 | | ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
|
142 | 142 |
|
143 | 143 | error: redundant closure
|
144 |
| - --> $DIR/eta.rs:333:19 |
| 144 | + --> $DIR/eta.rs:332:19 |
145 | 145 | |
|
146 | 146 | LL | slice_opt.map(|s| s.len());
|
147 | 147 | | ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
|
148 | 148 |
|
149 | 149 | error: redundant closure
|
150 |
| - --> $DIR/eta.rs:336:17 |
| 150 | + --> $DIR/eta.rs:335:17 |
151 | 151 | |
|
152 | 152 | LL | ptr_opt.map(|p| p.is_null());
|
153 | 153 | | ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
|
154 | 154 |
|
155 | 155 | error: redundant closure
|
156 |
| - --> $DIR/eta.rs:340:17 |
| 156 | + --> $DIR/eta.rs:339:17 |
157 | 157 | |
|
158 | 158 | LL | dyn_opt.map(|d| d.method_on_dyn());
|
159 | 159 | | ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
|
|
0 commit comments