diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9ffbe5..31e78e85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/pin-project-internal/src/pinned_drop.rs b/pin-project-internal/src/pinned_drop.rs index 0d0d879e..0b1f59d4 100644 --- a/pin-project-internal/src/pinned_drop.rs +++ b/pin-project-internal/src/pinned_drop.rs @@ -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() } } diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index f38e9e91..bdf10aa0 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -149,6 +149,7 @@ const _: () = { } }; #[doc(hidden)] +#[allow(unused_qualifications)] impl ::pin_project::__private::PinnedDrop for Enum { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index e62247ec..84cfc59e 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -108,6 +108,7 @@ const _: () = { } }; #[doc(hidden)] +#[allow(unused_qualifications)] impl ::pin_project::__private::PinnedDrop for Struct { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index 3909853e..191e6dc6 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -102,6 +102,7 @@ const _: () = { } }; #[doc(hidden)] +#[allow(unused_qualifications)] impl ::pin_project::__private::PinnedDrop for TupleStruct { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/include/basic.rs b/tests/include/basic.rs index a2e00d15..d4c1c951 100644 --- a/tests/include/basic.rs +++ b/tests/include/basic.rs @@ -2,17 +2,17 @@ include!("basic-safe-part.rs"); -#[allow(clippy::undocumented_unsafe_blocks)] +#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)] unsafe impl ::pin_project::UnsafeUnpin for UnsafeUnpinStruct { } -#[allow(clippy::undocumented_unsafe_blocks)] +#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)] unsafe impl ::pin_project::UnsafeUnpin for UnsafeUnpinTupleStruct { } -#[allow(clippy::undocumented_unsafe_blocks)] +#[allow(unused_qualifications, clippy::undocumented_unsafe_blocks)] unsafe impl ::pin_project::UnsafeUnpin for UnsafeUnpinEnum {