Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifetimes UI test cleanup #4120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: this lifetime isn't used in the function definition
--> $DIR/unused_lt.rs:14:14
--> $DIR/extra_unused_lifetimes.rs:14:14
|
LL | fn unused_lt<'a>(x: u8) {}
| ^^
|
= note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings`

error: this lifetime isn't used in the function definition
--> $DIR/unused_lt.rs:16:25
--> $DIR/extra_unused_lifetimes.rs:16:25
|
LL | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
| ^^

error: this lifetime isn't used in the function definition
--> $DIR/unused_lt.rs:41:10
--> $DIR/extra_unused_lifetimes.rs:41:10
|
LL | fn x<'a>(&self) {}
| ^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lifetimes.rs → tests/ui/needless_lifetimes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![warn(clippy::needless_lifetimes, clippy::extra_unused_lifetimes)]
#![warn(clippy::needless_lifetimes)]
#![allow(dead_code, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]

fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
Expand Down
30 changes: 15 additions & 15 deletions tests/ui/lifetimes.stderr → tests/ui/needless_lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:4:1
--> $DIR/needless_lifetimes.rs:4:1
|
LL | fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:6:1
--> $DIR/needless_lifetimes.rs:6:1
|
LL | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:16:1
--> $DIR/needless_lifetimes.rs:16:1
|
LL | / fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 {
LL | | x
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:45:1
--> $DIR/needless_lifetimes.rs:45:1
|
LL | / fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> {
LL | | Ok(x)
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:50:1
--> $DIR/needless_lifetimes.rs:50:1
|
LL | / fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()>
LL | | where
Expand All @@ -40,13 +40,13 @@ LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:62:1
--> $DIR/needless_lifetimes.rs:62:1
|
LL | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:86:1
--> $DIR/needless_lifetimes.rs:86:1
|
LL | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I>
LL | | where
Expand All @@ -57,61 +57,61 @@ LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:120:5
--> $DIR/needless_lifetimes.rs:120:5
|
LL | / fn self_and_out<'s>(&'s self) -> &'s u8 {
LL | | &self.x
LL | | }
| |_____^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:129:5
--> $DIR/needless_lifetimes.rs:129:5
|
LL | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:148:1
--> $DIR/needless_lifetimes.rs:148:1
|
LL | / fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str {
LL | | unimplemented!()
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:178:1
--> $DIR/needless_lifetimes.rs:178:1
|
LL | / fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str {
LL | | unimplemented!()
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:184:1
--> $DIR/needless_lifetimes.rs:184:1
|
LL | / fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str {
LL | | unimplemented!()
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:203:1
--> $DIR/needless_lifetimes.rs:203:1
|
LL | / fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
LL | | unimplemented!()
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:211:1
--> $DIR/needless_lifetimes.rs:211:1
|
LL | / fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) {
LL | | unimplemented!()
LL | | }
| |_^

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/lifetimes.rs:247:1
--> $DIR/needless_lifetimes.rs:247:1
|
LL | / fn out_return_type_lts<'a>(e: &'a str) -> Cow<'a> {
LL | | unimplemented!()
Expand Down