2024-08-31 07:31:31 -05:00
|
|
|
error: elided lifetime has a name
|
|
|
|
--> tests/ui/needless_lifetimes.rs:266:52
|
|
|
|
|
|
|
|
|
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
|
|
|
|
| -- ^ this elided lifetime gets resolved as `'a`
|
|
|
|
| |
|
|
|
|
| lifetime `'a` declared here
|
|
|
|
|
|
|
|
|
= note: `-D elided-named-lifetimes` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a, 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:17:23
|
2018-10-06 11:18:06 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^ ^^
|
2018-10-06 11:18:06 -05:00
|
|
|
|
|
|
|
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
|
|
|
|
LL + fn distinct_lifetimes(_x: &u8, _y: &u8, _z: u8) {}
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a, 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:19:24
|
2018-10-06 11:18:06 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
|
|
|
|
LL + fn distinct_and_static(_x: &u8, _y: &u8, _z: &'static u8) {}
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:29:15
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
|
|
|
|
LL + fn in_and_out(x: &u8, _y: u8) -> &u8 {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:41:31
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn multiple_in_and_out_2a<'a, 'b>(x: &'a u8, _y: &'b u8) -> &'a u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn multiple_in_and_out_2a<'a, 'b>(x: &'a u8, _y: &'b u8) -> &'a u8 {
|
|
|
|
LL + fn multiple_in_and_out_2a<'a>(x: &'a u8, _y: &u8) -> &'a u8 {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:48:27
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn multiple_in_and_out_2b<'a, 'b>(_x: &'a u8, y: &'b u8) -> &'b u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn multiple_in_and_out_2b<'a, 'b>(_x: &'a u8, y: &'b u8) -> &'b u8 {
|
|
|
|
LL + fn multiple_in_and_out_2b<'b>(_x: &u8, y: &'b u8) -> &'b u8 {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:65:26
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn deep_reference_1a<'a, 'b>(x: &'a u8, _y: &'b u8) -> Result<&'a u8, ()> {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn deep_reference_1a<'a, 'b>(x: &'a u8, _y: &'b u8) -> Result<&'a u8, ()> {
|
|
|
|
LL + fn deep_reference_1a<'a>(x: &'a u8, _y: &u8) -> Result<&'a u8, ()> {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:72:22
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn deep_reference_1b<'a, 'b>(_x: &'a u8, y: &'b u8) -> Result<&'b u8, ()> {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn deep_reference_1b<'a, 'b>(_x: &'a u8, y: &'b u8) -> Result<&'b u8, ()> {
|
|
|
|
LL + fn deep_reference_1b<'b>(_x: &u8, y: &'b u8) -> Result<&'b u8, ()> {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:81:21
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
|
|
|
|
LL + fn deep_reference_3(x: &u8, _y: u8) -> Result<&u8, ()> {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:86:28
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
|
|
|
|
LL + fn where_clause_without_lt<T>(x: &u8, _y: u8) -> Result<&u8, ()>
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a, 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:98:21
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
|
|
|
|
LL + fn lifetime_param_2(_x: Ref<'_>, _y: &u8) {}
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:122:15
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
|
|
|
|
LL + fn fn_bound_2<F, I>(_m: Lt<'_, I>, _f: F) -> Lt<'_, I>
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 's
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:152:21
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn self_and_out<'s>(&'s self) -> &'s u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn self_and_out<'s>(&'s self) -> &'s u8 {
|
|
|
|
LL + fn self_and_out(&self) -> &u8 {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 't
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:159:30
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn self_and_in_out_1<'s, 't>(&'s self, _x: &'t u8) -> &'s u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn self_and_in_out_1<'s, 't>(&'s self, _x: &'t u8) -> &'s u8 {
|
|
|
|
LL + fn self_and_in_out_1<'s>(&'s self, _x: &u8) -> &'s u8 {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 's
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:166:26
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn self_and_in_out_2<'s, 't>(&'s self, x: &'t u8) -> &'t u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn self_and_in_out_2<'s, 't>(&'s self, x: &'t u8) -> &'t u8 {
|
|
|
|
LL + fn self_and_in_out_2<'t>(&self, x: &'t u8) -> &'t u8 {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 's, 't
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:170:29
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
|
|
|
|
LL + fn distinct_self_and_in(&self, _x: &u8) {}
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:189:19
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
|
|
|
|
LL + fn struct_with_lt(_foo: Foo<'_>) -> &str {
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:207:25
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn struct_with_lt4a<'a, 'b>(_foo: &'a Foo<'b>) -> &'a str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn struct_with_lt4a<'a, 'b>(_foo: &'a Foo<'b>) -> &'a str {
|
|
|
|
LL + fn struct_with_lt4a<'a>(_foo: &'a Foo<'_>) -> &'a str {
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:215:21
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn struct_with_lt4b<'a, 'b>(_foo: &'a Foo<'b>) -> &'b str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn struct_with_lt4b<'a, 'b>(_foo: &'a Foo<'b>) -> &'b str {
|
|
|
|
LL + fn struct_with_lt4b<'b>(_foo: &Foo<'b>) -> &'b str {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:230:22
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn trait_obj_elided2<'a>(_arg: &'a dyn Drop) -> &'a str {
|
|
|
|
LL + fn trait_obj_elided2(_arg: &dyn Drop) -> &str {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:236:18
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
|
|
|
|
LL + fn alias_with_lt(_foo: FooAlias<'_>) -> &str {
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'b
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:254:24
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn alias_with_lt4a<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'a str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn alias_with_lt4a<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'a str {
|
|
|
|
LL + fn alias_with_lt4a<'a>(_foo: &'a FooAlias<'_>) -> &'a str {
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:262:20
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn alias_with_lt4b<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'b str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn alias_with_lt4b<'a, 'b>(_foo: &'a FooAlias<'b>) -> &'b str {
|
|
|
|
LL + fn alias_with_lt4b<'b>(_foo: &FooAlias<'b>) -> &'b str {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:266:30
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
|
|
|
|
LL + fn named_input_elided_output(_arg: &str) -> &str {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:274:19
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
|
|
|
|
LL + fn trait_bound_ok<T: WithLifetime<'static>>(_: &u8, _: T) {
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:310:24
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
2020-03-16 06:44:24 -05:00
|
|
|
LL | fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
|
|
|
|
LL + fn out_return_type_lts(e: &str) -> Cow<'_> {
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
2018-10-08 03:43:13 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:317:24
|
2019-09-01 01:11:40 -05:00
|
|
|
|
|
|
|
|
LL | fn needless_lt<'a>(x: &'a u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn needless_lt<'a>(x: &'a u8) {}
|
|
|
|
LL + fn needless_lt(x: &u8) {}
|
|
|
|
|
|
2019-09-01 01:11:40 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:321:24
|
2019-09-01 01:11:40 -05:00
|
|
|
|
|
|
|
|
LL | fn needless_lt<'a>(_x: &'a u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn needless_lt<'a>(_x: &'a u8) {}
|
|
|
|
LL + fn needless_lt(_x: &u8) {}
|
|
|
|
|
|
2019-09-01 01:11:40 -05:00
|
|
|
|
2024-08-18 06:31:03 -05:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
|
|
|
--> tests/ui/needless_lifetimes.rs:332:10
|
|
|
|
|
|
|
|
|
LL | impl<'a> Foo for Baz<'a> {}
|
|
|
|
| ^^ ^^
|
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - impl<'a> Foo for Baz<'a> {}
|
|
|
|
LL + impl Foo for Baz<'_> {}
|
|
|
|
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:334:16
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn baz<'a>(&'a self) -> impl Foo + 'a {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn baz<'a>(&'a self) -> impl Foo + 'a {
|
|
|
|
LL + fn baz(&self) -> impl Foo + '_ {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:366:55
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn impl_trait_elidable_nested_anonymous_lifetimes<'a>(i: &'a i32, f: impl Fn(&i32) -> &i32) -> &'a i32 {
|
|
|
|
LL + fn impl_trait_elidable_nested_anonymous_lifetimes(i: &i32, f: impl Fn(&i32) -> &i32) -> &i32 {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:375:26
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn generics_elidable<'a, T: Fn(&i32) -> &i32>(i: &'a i32, f: T) -> &'a i32 {
|
|
|
|
LL + fn generics_elidable<T: Fn(&i32) -> &i32>(i: &i32, f: T) -> &i32 {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-08-18 12:42:16 -05:00
|
|
|
--> tests/ui/needless_lifetimes.rs:387:30
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
2024-08-18 12:42:16 -05:00
|
|
|
LL | fn where_clause_elidable<'a, T>(i: &'a i32, f: T) -> &'a i32
|
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
2024-08-18 12:42:16 -05:00
|
|
|
LL - fn where_clause_elidable<'a, T>(i: &'a i32, f: T) -> &'a i32
|
|
|
|
LL + fn where_clause_elidable<T>(i: &i32, f: T) -> &i32
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:402:28
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn pointer_fn_elidable<'a>(i: &'a i32, f: fn(&i32) -> &i32) -> &'a i32 {
|
|
|
|
LL + fn pointer_fn_elidable(i: &i32, f: fn(&i32) -> &i32) -> &i32 {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:415:28
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn nested_fn_pointer_3<'a>(_: &'a i32) -> fn(fn(&i32) -> &i32) -> i32 {
|
|
|
|
LL + fn nested_fn_pointer_3(_: &i32) -> fn(fn(&i32) -> &i32) -> i32 {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:418:28
|
2020-10-09 05:45:29 -05:00
|
|
|
|
|
|
|
|
LL | fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn nested_fn_pointer_4<'a>(_: &'a i32) -> impl Fn(fn(&i32)) {
|
|
|
|
LL + fn nested_fn_pointer_4(_: &i32) -> impl Fn(fn(&i32)) {
|
|
|
|
|
|
2020-10-09 05:45:29 -05:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:440:21
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn implicit<'a>(&'a self) -> &'a () {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn implicit<'a>(&'a self) -> &'a () {
|
|
|
|
LL + fn implicit(&self) -> &() {
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:443:25
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn implicit_mut<'a>(&'a mut self) -> &'a () {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn implicit_mut<'a>(&'a mut self) -> &'a () {
|
|
|
|
LL + fn implicit_mut(&mut self) -> &() {
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:454:31
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
|
|
|
LL + fn lifetime_elsewhere(self: Box<Self>, here: &()) -> &() {
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:460:21
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn implicit<'a>(&'a self) -> &'a ();
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn implicit<'a>(&'a self) -> &'a ();
|
|
|
|
LL + fn implicit(&self) -> &();
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:461:30
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn implicit_provided<'a>(&'a self) -> &'a () {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn implicit_provided<'a>(&'a self) -> &'a () {
|
|
|
|
LL + fn implicit_provided(&self) -> &() {
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:470:31
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a ();
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn lifetime_elsewhere<'a>(self: Box<Self>, here: &'a ()) -> &'a ();
|
|
|
|
LL + fn lifetime_elsewhere(self: Box<Self>, here: &()) -> &();
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:471:40
|
2022-01-27 08:12:45 -06:00
|
|
|
|
|
|
|
|
LL | fn lifetime_elsewhere_provided<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn lifetime_elsewhere_provided<'a>(self: Box<Self>, here: &'a ()) -> &'a () {
|
|
|
|
LL + fn lifetime_elsewhere_provided(self: Box<Self>, here: &()) -> &() {
|
|
|
|
|
|
2022-01-27 08:12:45 -06:00
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:480:12
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn foo<'a>(x: &'a u8, y: &'_ u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn foo<'a>(x: &'a u8, y: &'_ u8) {}
|
|
|
|
LL + fn foo(x: &u8, y: &'_ u8) {}
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:482:12
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn bar<'a>(x: &'a u8, y: &'_ u8, z: &'_ u8) {}
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn bar<'a>(x: &'a u8, y: &'_ u8, z: &'_ u8) {}
|
|
|
|
LL + fn bar(x: &u8, y: &'_ u8, z: &'_ u8) {}
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:489:18
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn one_input<'a>(x: &'a u8) -> &'a u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn one_input<'a>(x: &'a u8) -> &'a u8 {
|
|
|
|
LL + fn one_input(x: &u8) -> &u8 {
|
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:494:42
|
2022-11-21 13:34:47 -06:00
|
|
|
|
|
|
|
|
LL | fn multiple_inputs_output_not_elided<'a, 'b>(x: &'a u8, y: &'b u8, z: &'b u8) -> &'b u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
|
|
|
LL - fn multiple_inputs_output_not_elided<'a, 'b>(x: &'a u8, y: &'b u8, z: &'b u8) -> &'b u8 {
|
|
|
|
LL + fn multiple_inputs_output_not_elided<'b>(x: &u8, y: &'b u8, z: &'b u8) -> &'b u8 {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: the following explicit lifetimes could be elided: 'a
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/needless_lifetimes.rs:510:22
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
2023-03-24 08:04:35 -05:00
|
|
|
LL | fn one_input<'a>(x: &'a u8) -> &'a u8 {
|
2023-07-02 07:35:19 -05:00
|
|
|
| ^^ ^^ ^^
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
2023-03-24 08:04:35 -05:00
|
|
|
= note: this error originates in the macro `__inline_mac_mod_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
|
2023-02-10 07:01:19 -06:00
|
|
|
help: elide the lifetimes
|
|
|
|
|
|
2023-03-24 08:04:35 -05:00
|
|
|
LL - fn one_input<'a>(x: &'a u8) -> &'a u8 {
|
|
|
|
LL + fn one_input(x: &u8) -> &u8 {
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
2022-11-21 13:34:47 -06:00
|
|
|
|
2024-08-18 06:31:03 -05:00
|
|
|
error: aborting due to 48 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|