]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/eta.stderr
Auto merge of #104963 - petrochenkov:noaddids2, r=cjgillot
[rust.git] / src / tools / clippy / tests / ui / eta.stderr
1 error: redundant closure
2   --> $DIR/eta.rs:28: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:32:40
11    |
12 LL |     let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
13    |                                        ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
14
15 error: redundant closure
16   --> $DIR/eta.rs:33:35
17    |
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`
20
21 error: redundant closure
22   --> $DIR/eta.rs:34:26
23    |
24 LL |     all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
25    |                          ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
26
27 error: redundant closure
28   --> $DIR/eta.rs:41:27
29    |
30 LL |     let e = Some(1u8).map(|a| generic(a));
31    |                           ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
32
33 error: redundant closure
34   --> $DIR/eta.rs:87:51
35    |
36 LL |     let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
37    |                                                   ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
38    |
39    = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
40
41 error: redundant closure
42   --> $DIR/eta.rs:88:51
43    |
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`
46
47 error: redundant closure
48   --> $DIR/eta.rs:90:42
49    |
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`
52
53 error: redundant closure
54   --> $DIR/eta.rs:94:29
55    |
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`
58
59 error: redundant closure
60   --> $DIR/eta.rs:95:27
61    |
62 LL |     let e = Some('a').map(|s| s.to_uppercase());
63    |                           ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
64
65 error: redundant closure
66   --> $DIR/eta.rs:97:65
67    |
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`
70
71 error: redundant closure
72   --> $DIR/eta.rs:160:22
73    |
74 LL |     requires_fn_once(|| x());
75    |                      ^^^^^^ help: replace the closure with the function itself: `x`
76
77 error: redundant closure
78   --> $DIR/eta.rs:167:27
79    |
80 LL |     let a = Some(1u8).map(|a| foo_ptr(a));
81    |                           ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
82
83 error: redundant closure
84   --> $DIR/eta.rs:172:27
85    |
86 LL |     let a = Some(1u8).map(|a| closure(a));
87    |                           ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
88
89 error: redundant closure
90   --> $DIR/eta.rs:204:28
91    |
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`
94
95 error: redundant closure
96   --> $DIR/eta.rs:205:28
97    |
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`
100
101 error: redundant closure
102   --> $DIR/eta.rs:206:28
103    |
104 LL |     z.into_iter().for_each(|x| add_to_res(x));
105    |                            ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
106
107 error: redundant closure
108   --> $DIR/eta.rs:213:21
109    |
110 LL |         Some(1).map(|n| closure(n));
111    |                     ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
112
113 error: redundant closure
114   --> $DIR/eta.rs:217:21
115    |
116 LL |         Some(1).map(|n| in_loop(n));
117    |                     ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
118
119 error: redundant closure
120   --> $DIR/eta.rs:310:18
121    |
122 LL |     takes_fn_mut(|| f());
123    |                  ^^^^^^ help: replace the closure with the function itself: `&mut f`
124
125 error: redundant closure
126   --> $DIR/eta.rs:313:19
127    |
128 LL |     takes_fn_once(|| f());
129    |                   ^^^^^^ help: replace the closure with the function itself: `&mut f`
130
131 error: redundant closure
132   --> $DIR/eta.rs:317:26
133    |
134 LL |     move || takes_fn_mut(|| f_used_once())
135    |                          ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
136
137 error: redundant closure
138   --> $DIR/eta.rs:329:19
139    |
140 LL |     array_opt.map(|a| a.as_slice());
141    |                   ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
142
143 error: redundant closure
144   --> $DIR/eta.rs:332:19
145    |
146 LL |     slice_opt.map(|s| s.len());
147    |                   ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
148
149 error: redundant closure
150   --> $DIR/eta.rs:335:17
151    |
152 LL |     ptr_opt.map(|p| p.is_null());
153    |                 ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
154
155 error: redundant closure
156   --> $DIR/eta.rs:339:17
157    |
158 LL |     dyn_opt.map(|d| d.method_on_dyn());
159    |                 ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
160
161 error: aborting due to 26 previous errors
162