]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/needless_lifetimes.stderr
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / src / tools / clippy / tests / ui / needless_lifetimes.stderr
1 error: the following explicit lifetimes could be elided: 'a, 'b
2   --> $DIR/needless_lifetimes.rs:11:1
3    |
4 LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
8
9 error: the following explicit lifetimes could be elided: 'a, 'b
10   --> $DIR/needless_lifetimes.rs:13:1
11    |
12 LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
13    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: the following explicit lifetimes could be elided: 'a
16   --> $DIR/needless_lifetimes.rs:23:1
17    |
18 LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
19    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
21 error: the following explicit lifetimes could be elided: 'b
22   --> $DIR/needless_lifetimes.rs:35:1
23    |
24 LL | fn multiple_in_and_out_2a<'a, 'b>(x: &'a u8, _y: &'b u8) -> &'a u8 {
25    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27 error: the following explicit lifetimes could be elided: 'a
28   --> $DIR/needless_lifetimes.rs:42:1
29    |
30 LL | fn multiple_in_and_out_2b<'a, 'b>(_x: &'a u8, y: &'b u8) -> &'b u8 {
31    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32
33 error: the following explicit lifetimes could be elided: 'b
34   --> $DIR/needless_lifetimes.rs:59:1
35    |
36 LL | fn deep_reference_1a<'a, 'b>(x: &'a u8, _y: &'b u8) -> Result<&'a u8, ()> {
37    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
39 error: the following explicit lifetimes could be elided: 'a
40   --> $DIR/needless_lifetimes.rs:66:1
41    |
42 LL | fn deep_reference_1b<'a, 'b>(_x: &'a u8, y: &'b u8) -> Result<&'b u8, ()> {
43    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
45 error: the following explicit lifetimes could be elided: 'a
46   --> $DIR/needless_lifetimes.rs:75:1
47    |
48 LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
49    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
51 error: the following explicit lifetimes could be elided: 'a
52   --> $DIR/needless_lifetimes.rs:80:1
53    |
54 LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
55    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
57 error: the following explicit lifetimes could be elided: 'a, 'b
58   --> $DIR/needless_lifetimes.rs:92:1
59    |
60 LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
61    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62    |
63 help: replace with `'_` in generic arguments such as here
64   --> $DIR/needless_lifetimes.rs:92:37
65    |
66 LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
67    |                                     ^^
68
69 error: the following explicit lifetimes could be elided: 'a
70   --> $DIR/needless_lifetimes.rs:116:1
71    |
72 LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
73    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74    |
75 help: replace with `'_` in generic arguments such as here
76   --> $DIR/needless_lifetimes.rs:116:32
77    |
78 LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
79    |                                ^^
80
81 error: the following explicit lifetimes could be elided: 's
82   --> $DIR/needless_lifetimes.rs:146:5
83    |
84 LL |     fn self_and_out<'s>(&'s self) -> &'s u8 {
85    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86
87 error: the following explicit lifetimes could be elided: 't
88   --> $DIR/needless_lifetimes.rs:153:5
89    |
90 LL |     fn self_and_in_out_1<'s, 't>(&'s self, _x: &'t u8) -> &'s u8 {
91    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
93 error: the following explicit lifetimes could be elided: 's
94   --> $DIR/needless_lifetimes.rs:160:5
95    |
96 LL |     fn self_and_in_out_2<'s, 't>(&'s self, x: &'t u8) -> &'t u8 {
97    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98
99 error: the following explicit lifetimes could be elided: 's, 't
100   --> $DIR/needless_lifetimes.rs:164:5
101    |
102 LL |     fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
103    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105 error: the following explicit lifetimes could be elided: 'a
106   --> $DIR/needless_lifetimes.rs:183:1
107    |
108 LL | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
109    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110    |
111 help: replace with `'_` in generic arguments such as here
112   --> $DIR/needless_lifetimes.rs:183:33
113    |
114 LL | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
115    |                                 ^^
116
117 error: the following explicit lifetimes could be elided: 'b
118   --> $DIR/needless_lifetimes.rs:201:1
119    |
120 LL | fn struct_with_lt4a<'a, 'b>(_foo: &'a Foo<'b>) -> &'a str {
121    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122    |
123 help: replace with `'_` in generic arguments such as here
124   --> $DIR/needless_lifetimes.rs:201:43
125    |
126 LL | fn struct_with_lt4a<'a, 'b>(_foo: &'a Foo<'b>) -> &'a str {
127    |                                           ^^
128
129 error: the following explicit lifetimes could be elided: 'a
130   --> $DIR/needless_lifetimes.rs:209:1
131    |
132 LL | fn struct_with_lt4b<'a, 'b>(_foo: &'a Foo<'b>) -> &'b str {
133    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134
135 error: the following explicit lifetimes could be elided: 'a
136   --> $DIR/needless_lifetimes.rs:224:1
137    |
138 LL | fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {
139    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
141 error: the following explicit lifetimes could be elided: 'a
142   --> $DIR/needless_lifetimes.rs:230:1
143    |
144 LL | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
145    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146    |
147 help: replace with `'_` in generic arguments such as here
148   --> $DIR/needless_lifetimes.rs:230:37
149    |
150 LL | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
151    |                                     ^^
152
153 error: the following explicit lifetimes could be elided: 'b
154   --> $DIR/needless_lifetimes.rs:248:1
155    |
156 LL | fn alias_with_lt4a<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'a str {
157    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158    |
159 help: replace with `'_` in generic arguments such as here
160   --> $DIR/needless_lifetimes.rs:248:47
161    |
162 LL | fn alias_with_lt4a<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'a str {
163    |                                               ^^
164
165 error: the following explicit lifetimes could be elided: 'a
166   --> $DIR/needless_lifetimes.rs:256:1
167    |
168 LL | fn alias_with_lt4b<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'b str {
169    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170
171 error: the following explicit lifetimes could be elided: 'a
172   --> $DIR/needless_lifetimes.rs:260:1
173    |
174 LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
175    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176
177 error: the following explicit lifetimes could be elided: 'a
178   --> $DIR/needless_lifetimes.rs:268:1
179    |
180 LL | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
181    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182
183 error: the following explicit lifetimes could be elided: 'a
184   --> $DIR/needless_lifetimes.rs:304:1
185    |
186 LL | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
187    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188    |
189 help: replace with `'_` in generic arguments such as here
190   --> $DIR/needless_lifetimes.rs:304:47
191    |
192 LL | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
193    |                                               ^^
194
195 error: the following explicit lifetimes could be elided: 'a
196   --> $DIR/needless_lifetimes.rs:311:9
197    |
198 LL |         fn needless_lt<'a>(x: &'a u8) {}
199    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200
201 error: the following explicit lifetimes could be elided: 'a
202   --> $DIR/needless_lifetimes.rs:315:9
203    |
204 LL |         fn needless_lt<'a>(_x: &'a u8) {}
205    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
206
207 error: the following explicit lifetimes could be elided: 'a
208   --> $DIR/needless_lifetimes.rs:328:9
209    |
210 LL |         fn baz<'a>(&'a self) -> impl Foo + 'a {
211    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
212
213 error: the following explicit lifetimes could be elided: 'a
214   --> $DIR/needless_lifetimes.rs:360:5
215    |
216 LL |     fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 {
217    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
218
219 error: the following explicit lifetimes could be elided: 'a
220   --> $DIR/needless_lifetimes.rs:369:5
221    |
222 LL |     fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 {
223    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
224
225 error: the following explicit lifetimes could be elided: 'a
226   --> $DIR/needless_lifetimes.rs:381:5
227    |
228 LL |     fn where_clause_elidadable<'a, T>(i: &'a i32, f: T) -> &'a i32
229    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230
231 error: the following explicit lifetimes could be elided: 'a
232   --> $DIR/needless_lifetimes.rs:396:5
233    |
234 LL |     fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 {
235    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
236
237 error: the following explicit lifetimes could be elided: 'a
238   --> $DIR/needless_lifetimes.rs:409:5
239    |
240 LL |     fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 {
241    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242
243 error: the following explicit lifetimes could be elided: 'a
244   --> $DIR/needless_lifetimes.rs:412:5
245    |
246 LL |     fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) {
247    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
248
249 error: the following explicit lifetimes could be elided: 'a
250   --> $DIR/needless_lifetimes.rs:434:9
251    |
252 LL |         fn implicit<'a>(&'a self) -> &'a () {
253    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
254
255 error: the following explicit lifetimes could be elided: 'a
256   --> $DIR/needless_lifetimes.rs:437:9
257    |
258 LL |         fn implicit_mut<'a>(&'a mut self) -> &'a () {
259    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
260
261 error: the following explicit lifetimes could be elided: 'a
262   --> $DIR/needless_lifetimes.rs:448:9
263    |
264 LL |         fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
265    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266
267 error: the following explicit lifetimes could be elided: 'a
268   --> $DIR/needless_lifetimes.rs:454:9
269    |
270 LL |         fn implicit<'a>(&'a self) -> &'a ();
271    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272
273 error: the following explicit lifetimes could be elided: 'a
274   --> $DIR/needless_lifetimes.rs:455:9
275    |
276 LL |         fn implicit_provided<'a>(&'a self) -> &'a () {
277    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278
279 error: the following explicit lifetimes could be elided: 'a
280   --> $DIR/needless_lifetimes.rs:464:9
281    |
282 LL |         fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a ();
283    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
284
285 error: the following explicit lifetimes could be elided: 'a
286   --> $DIR/needless_lifetimes.rs:465:9
287    |
288 LL |         fn lifetime_elsewhere_provided<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
289    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290
291 error: the following explicit lifetimes could be elided: 'a
292   --> $DIR/needless_lifetimes.rs:474:5
293    |
294 LL |     fn foo<'a>(x: &'a u8, y: &'_ u8) {}
295    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296
297 error: the following explicit lifetimes could be elided: 'a
298   --> $DIR/needless_lifetimes.rs:476:5
299    |
300 LL |     fn bar<'a>(x: &'a u8, y: &'_ u8, z: &'_ u8) {}
301    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
302
303 error: the following explicit lifetimes could be elided: 'a
304   --> $DIR/needless_lifetimes.rs:483:5
305    |
306 LL |     fn one_input<'a>(x: &'a u8) -> &'a u8 {
307    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
308
309 error: the following explicit lifetimes could be elided: 'a
310   --> $DIR/needless_lifetimes.rs:488:5
311    |
312 LL |     fn multiple_inputs_output_not_elided<'a, 'b>(x: &'a u8, y: &'b u8, z: &'b u8) -> &'b u8 {
313    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
314
315 error: aborting due to 45 previous errors
316