Skip to content

Commit

Permalink
Suppress unused_qualifications lint in generated code
Browse files Browse the repository at this point in the history
```
error: unnecessary qualification
  --> tests/lint/../include/basic-safe-part.rs:76:12
   |
76 | impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
   |            ^^^^^^^^^^
   |
   = note: `-D unused-qualifications` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_qualifications)]`
help: remove the unnecessary path segments
   |
76 | impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
   |
```
  • Loading branch information
taiki-e committed Mar 5, 2024
1 parent fd08c71 commit 78d23fd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Suppress `unused_qualifications` lint in generated code.

## [1.1.4] - 2024-01-25

- Suppress `clippy::missing_docs_in_private_items` and `clippy::missing_inline_in_public_items` lints in generated code. ([#356](https://github.com/taiki-e/pin-project/pull/356), thanks @daxpedda)
Expand Down
1 change: 1 addition & 0 deletions pin-project-internal/src/pinned_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub(crate) fn attribute(args: &TokenStream, mut input: ItemImpl) -> TokenStream
}
tokens
} else {
input.attrs.push(parse_quote!(#[allow(unused_qualifications)]));
input.into_token_stream()
}
}
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 @@ -149,6 +149,7 @@ const _: () = {
}
};
#[doc(hidden)]
#[allow(unused_qualifications)]
impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(clippy::needless_pass_by_value)]
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 @@ -108,6 +108,7 @@ const _: () = {
}
};
#[doc(hidden)]
#[allow(unused_qualifications)]
impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(clippy::needless_pass_by_value)]
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 @@ -102,6 +102,7 @@ const _: () = {
}
};
#[doc(hidden)]
#[allow(unused_qualifications)]
impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> {
unsafe fn drop(self: Pin<&mut Self>) {
#[allow(clippy::needless_pass_by_value)]
Expand Down
6 changes: 3 additions & 3 deletions tests/include/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

include!("basic-safe-part.rs");

#[allow(clippy::undocumented_unsafe_blocks)]
#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinStruct<T, U>
{
}
#[allow(clippy::undocumented_unsafe_blocks)]
#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinTupleStruct<T, U>
{
}
#[allow(clippy::undocumented_unsafe_blocks)]
#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)]
unsafe impl<T: ::pin_project::__private::Unpin, U: ::pin_project::__private::Unpin>
::pin_project::UnsafeUnpin for UnsafeUnpinEnum<T, U>
{
Expand Down

0 comments on commit 78d23fd

Please sign in to comment.