Skip to content

Commit

Permalink
Suppress clippy::elidable_lifetime_names lint in generated code
Browse files Browse the repository at this point in the history
```
error: the following explicit lifetimes could be elided: 'a
  --> examples/pinned_drop-expanded.rs:98:33
   |
98 |     fn __assert_not_repr_packed<'a, T>(this: &Struct<'a, T>) {
   |                                 ^^                   ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#elidable_lifetime_names
   = note: `-D clippy::elidable-lifetime-names` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::elidable_lifetime_names)]`
help: elide the lifetimes
   |
98 -     fn __assert_not_repr_packed<'a, T>(this: &Struct<'a, T>) {
98 +     fn __assert_not_repr_packed<T>(this: &Struct<'_, T>) {
   |

error: the following explicit lifetimes could be elided: 'a
   --> examples/pinned_drop-expanded.rs:103:10
    |
103 |     impl<'a, T> ::pin_project::__private::Drop for Struct<'a, T> {
    |          ^^                                               ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#elidable_lifetime_names
help: elide the lifetimes
    |
103 -     impl<'a, T> ::pin_project::__private::Drop for Struct<'a, T> {
103 +     impl<T> ::pin_project::__private::Drop for Struct<'_, T> {
    |

error: could not compile `pin-project` (example "pinned_drop-expanded") due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: the following explicit lifetimes could be elided: 'a
   --> tests/proper_unpin.rs:147:19
    |
147 |     struct PinRef<'a, T, U> {
    |                   ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#elidable_lifetime_names
    = note: `-D clippy::elidable-lifetime-names` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::elidable_lifetime_names)]`
help: elide the lifetimes
    |
147 -     struct PinRef<'a, T, U> {
147 +     struct PinRef<'_, T, U> {
    |
```
  • Loading branch information
taiki-e committed Mar 3, 2025
1 parent 2714ef5 commit 12dfb3c
Show file tree
Hide file tree
Showing 40 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
compiletest
elidable
expandtest
HRTB
overindented
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Suppress `clippy::elidable_lifetime_names` lint in generated code.

## [1.1.9] - 2025-02-03

- Suppress `clippy::missing_const_for_fn` lint in generated code.
Expand Down
1 change: 1 addition & 0 deletions examples/pinned_drop-expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
unknown_lints,
renamed_and_removed_lints,
unnameable_types,
clippy::elidable_lifetime_names,
clippy::mut_mut,
clippy::needless_lifetimes,
clippy::undocumented_unsafe_blocks
Expand Down
1 change: 1 addition & 0 deletions pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl GenerateTokens {
#[allow(
unused_qualifications,
#allowed_lints
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/default/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/default/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/default/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/multifields/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ enum EnumProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/multifields/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/multifields/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum Enum<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/struct-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/struct-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/struct-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/struct-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/struct-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/tuple_struct-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/tuple_struct-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/tuple_struct-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/tuple_struct-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/tuple_struct-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/not_unpin/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/not_unpin/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/not_unpin/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pinned_drop/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pinned_drop/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pinned_drop/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/project_replace/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum EnumProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/project_replace/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/project_replace/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pub/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pub/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/pub/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct TupleStruct<T, U>(#[pin] pub T, pub U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/unsafe_unpin/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/unsafe_unpin/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/unsafe_unpin/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::elidable_lifetime_names,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
Expand Down

0 comments on commit 12dfb3c

Please sign in to comment.