diff --git a/pin-project-internal/src/pin_project/derive.rs b/pin-project-internal/src/pin_project/derive.rs index fa398934..78568cf9 100644 --- a/pin-project-internal/src/pin_project/derive.rs +++ b/pin-project-internal/src/pin_project/derive.rs @@ -85,10 +85,13 @@ impl GenerateTokens { // - https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867 // - https://github.com/taiki-e/pin-project/pull/70 #allowed_lints + #[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #scoped #unpin_impl #drop_impl @@ -581,10 +584,10 @@ fn visit_fields<'a>( #vis #ident #colon_token ::pin_project::__private::PhantomData<#ty>, }); proj_body.extend(quote! { - #ident #colon_token ::pin_project::__private::Pin::new_unchecked(#binding), + #ident #colon_token _pin_project::__private::Pin::new_unchecked(#binding), }); proj_move.extend(quote! { - #ident #colon_token ::pin_project::__private::PhantomData, + #ident #colon_token _pin_project::__private::PhantomData, }); cx.pinned_fields.push(ty); @@ -603,7 +606,7 @@ fn visit_fields<'a>( #binding, }); proj_move.extend(quote! { - #ident #colon_token ::pin_project::__private::ptr::read(#binding), + #ident #colon_token _pin_project::__private::ptr::read(#binding), }); } } @@ -658,7 +661,7 @@ fn proj_own_body( // if any of the destructors panic. { #( - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(#pinned_fields); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(#pinned_fields); )* } @@ -682,14 +685,14 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { // Make the error message highlight `UnsafeUnpin` argument. proj_generics.make_where_clause().predicates.push(parse_quote_spanned! { span => - ::pin_project::__private::Wrapper<#lifetime, Self>: ::pin_project::UnsafeUnpin + _pin_project::__private::Wrapper<#lifetime, Self>: _pin_project::UnsafeUnpin }); let (impl_generics, _, where_clause) = proj_generics.split_for_impl(); let ty_generics = cx.orig.generics.split_for_impl().1; quote_spanned! { span => - impl #impl_generics ::pin_project::__private::Unpin for #orig_ident #ty_generics + impl #impl_generics _pin_project::__private::Unpin for #orig_ident #ty_generics #where_clause { } @@ -701,9 +704,9 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { let lifetime = &cx.proj.lifetime; proj_generics.make_where_clause().predicates.push(parse_quote! { - ::pin_project::__private::Wrapper< - #lifetime, ::pin_project::__private::PhantomPinned - >: ::pin_project::__private::Unpin + _pin_project::__private::Wrapper< + #lifetime, _pin_project::__private::PhantomPinned + >: _pin_project::__private::Unpin }); let (proj_impl_generics, _, proj_where_clause) = proj_generics.split_for_impl(); @@ -713,7 +716,7 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { // call-site span. let unsafety = ::default(); quote_spanned! { span => - impl #proj_impl_generics ::pin_project::__private::Unpin + impl #proj_impl_generics _pin_project::__private::Unpin for #orig_ident #ty_generics #proj_where_clause { @@ -726,7 +729,7 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { // impl, they'll get a "conflicting implementations of trait" error when // coherence checks are run. #[doc(hidden)] - #unsafety impl #proj_impl_generics ::pin_project::UnsafeUnpin + #unsafety impl #proj_impl_generics _pin_project::UnsafeUnpin for #orig_ident #ty_generics #proj_where_clause { @@ -781,7 +784,7 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { let (_, ty_generics, where_clause) = cx.orig.generics.split_for_impl(); full_where_clause.predicates.push(parse_quote! { - #struct_ident #proj_ty_generics: ::pin_project::__private::Unpin + #struct_ident #proj_ty_generics: _pin_project::__private::Unpin }); quote! { @@ -797,15 +800,15 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { // this 'public' type by creating this type in the inside of `const`. #[allow(missing_debug_implementations)] #vis struct #struct_ident #proj_generics #where_clause { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< - #lifetime, (#(::pin_project::__private::PhantomData<#type_params>),*) + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + #lifetime, (#(_pin_project::__private::PhantomData<#type_params>),*) >, #(#fields,)* #(#lifetime_fields,)* } - impl #proj_impl_generics ::pin_project::__private::Unpin + impl #proj_impl_generics _pin_project::__private::Unpin for #orig_ident #ty_generics #full_where_clause { @@ -818,7 +821,7 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream { // impl, they'll get a "conflicting implementations of trait" error when // coherence checks are run. #[doc(hidden)] - unsafe impl #proj_impl_generics ::pin_project::UnsafeUnpin + unsafe impl #proj_impl_generics _pin_project::UnsafeUnpin for #orig_ident #ty_generics #full_where_clause { @@ -843,18 +846,18 @@ fn make_drop_impl(cx: &Context<'_>) -> TokenStream { // call-site span. let unsafety = ::default(); quote_spanned! { span => - impl #impl_generics ::pin_project::__private::Drop for #ident #ty_generics + impl #impl_generics _pin_project::__private::Drop for #ident #ty_generics #where_clause { fn drop(&mut self) { #unsafety { // Safety - we're in 'drop', so we know that 'self' will // never move again. - let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); + let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); // We call `pinned_drop` only once. Since `PinnedDrop::drop` // is an unsafe method and a private API, it is never called again in safe // code *unless the user uses a maliciously crafted macro*. - ::pin_project::__private::PinnedDrop::drop(__pinned_self); + _pin_project::__private::PinnedDrop::drop(__pinned_self); } } } @@ -886,7 +889,7 @@ fn make_drop_impl(cx: &Context<'_>) -> TokenStream { // This will result in a compilation error, which is exactly what we want. trait #trait_ident {} #[allow(clippy::drop_bounds, drop_bounds)] - impl #trait_ident for T {} + impl #trait_ident for T {} impl #impl_generics #trait_ident for #ident #ty_generics #where_clause {} // Generate a dummy impl of `PinnedDrop`, to ensure that the user cannot implement it. @@ -900,10 +903,10 @@ fn make_drop_impl(cx: &Context<'_>) -> TokenStream { // they'll get a "conflicting implementations of trait" error when coherence // checks are run. #[doc(hidden)] - impl #impl_generics ::pin_project::__private::PinnedDrop for #ident #ty_generics + impl #impl_generics _pin_project::__private::PinnedDrop for #ident #ty_generics #where_clause { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } } } @@ -934,7 +937,7 @@ fn make_proj_impl( let mut project = Some(quote! { #vis fn project<#lifetime>( - self: ::pin_project::__private::Pin<&#lifetime mut Self>, + self: _pin_project::__private::Pin<&#lifetime mut Self>, ) -> #proj_ident #proj_ty_generics { unsafe { #proj_body @@ -944,7 +947,7 @@ fn make_proj_impl( let mut project_ref = Some(quote! { #[allow(clippy::missing_const_for_fn)] #vis fn project_ref<#lifetime>( - self: ::pin_project::__private::Pin<&#lifetime Self>, + self: _pin_project::__private::Pin<&#lifetime Self>, ) -> #proj_ref_ident #proj_ty_generics { unsafe { #proj_ref_body @@ -955,7 +958,7 @@ fn make_proj_impl( // It is enough to only set the span of the signature. let sig = quote_spanned! { span => #vis fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> #proj_own_ident #orig_ty_generics }; @@ -966,9 +969,9 @@ fn make_proj_impl( // Destructors will run in reverse order, so next create a guard to overwrite // `self` with the replacement value without calling destructors. - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; #proj_own_body diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs index 75ec2fe3..a3b03385 100644 --- a/tests/expand/default/enum.expanded.rs +++ b/tests/expand/default/enum.expanded.rs @@ -62,22 +62,25 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -85,16 +88,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -103,32 +106,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 794675a3..3089a545 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -14,10 +14,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -38,24 +41,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -68,31 +71,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index 6a3dfbfe..cc9b75e6 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -32,20 +35,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -56,31 +59,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs index 6ccbd9d5..4347a5e9 100644 --- a/tests/expand/multifields/enum.expanded.rs +++ b/tests/expand/multifields/enum.expanded.rs @@ -106,13 +106,16 @@ enum EnumProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { @@ -122,14 +125,14 @@ const _: () = { unpinned1, unpinned2, } => EnumProj::Struct { - pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, }, Self::Tuple(_0, _1, _2, _3) => EnumProj::Tuple( - ::pin_project::__private::Pin::new_unchecked(_0), - ::pin_project::__private::Pin::new_unchecked(_1), + _pin_project::__private::Pin::new_unchecked(_0), + _pin_project::__private::Pin::new_unchecked(_1), _2, _3, ), @@ -139,7 +142,7 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { @@ -149,14 +152,14 @@ const _: () = { unpinned1, unpinned2, } => EnumProjRef::Struct { - pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, }, Self::Tuple(_0, _1, _2, _3) => EnumProjRef::Tuple( - ::pin_project::__private::Pin::new_unchecked(_0), - ::pin_project::__private::Pin::new_unchecked(_1), + _pin_project::__private::Pin::new_unchecked(_0), + _pin_project::__private::Pin::new_unchecked(_1), _2, _3, ), @@ -165,14 +168,14 @@ const _: () = { } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> EnumProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; match &mut *__self_ptr { Self::Struct { @@ -182,27 +185,27 @@ const _: () = { unpinned2, } => { let __result = EnumProjOwn::Struct { - pinned1: ::pin_project::__private::PhantomData, - pinned2: ::pin_project::__private::PhantomData, - unpinned1: ::pin_project::__private::ptr::read(unpinned1), - unpinned2: ::pin_project::__private::ptr::read(unpinned2), + pinned1: _pin_project::__private::PhantomData, + pinned2: _pin_project::__private::PhantomData, + unpinned1: _pin_project::__private::ptr::read(unpinned1), + unpinned2: _pin_project::__private::ptr::read(unpinned2), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned2); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned2); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned1); } __result } Self::Tuple(_0, _1, _2, _3) => { let __result = EnumProjOwn::Tuple( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_2), - ::pin_project::__private::ptr::read(_3), + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_2), + _pin_project::__private::ptr::read(_3), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_1); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -217,11 +220,11 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, @@ -229,22 +232,22 @@ const _: () = { __field2: T, __field3: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index 7e3505bd..77879ce1 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -17,10 +17,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -52,7 +55,7 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { @@ -62,8 +65,8 @@ const _: () = { unpinned2, } = self.get_unchecked_mut(); __StructProjection { - pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, } @@ -71,7 +74,7 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { @@ -81,22 +84,22 @@ const _: () = { unpinned2, } = self.get_ref(); __StructProjectionRef { - pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, } } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self { pinned1, @@ -105,14 +108,14 @@ const _: () = { unpinned2, } = &mut *__self_ptr; let __result = __StructProjectionOwned { - pinned1: ::pin_project::__private::PhantomData, - pinned2: ::pin_project::__private::PhantomData, - unpinned1: ::pin_project::__private::ptr::read(unpinned1), - unpinned2: ::pin_project::__private::ptr::read(unpinned2), + pinned1: _pin_project::__private::PhantomData, + pinned2: _pin_project::__private::PhantomData, + unpinned1: _pin_project::__private::ptr::read(unpinned1), + unpinned2: _pin_project::__private::ptr::read(unpinned2), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned2); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned2); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned1); } __result } @@ -127,32 +130,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index 7b47899e..e35b6417 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, #[pin] T, U, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -43,13 +46,13 @@ const _: () = { ); impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1, _2, _3) = self.get_unchecked_mut(); __TupleStructProjection( - ::pin_project::__private::Pin::new_unchecked(_0), - ::pin_project::__private::Pin::new_unchecked(_1), + _pin_project::__private::Pin::new_unchecked(_0), + _pin_project::__private::Pin::new_unchecked(_1), _2, _3, ) @@ -57,38 +60,38 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1, _2, _3) = self.get_ref(); __TupleStructProjectionRef( - ::pin_project::__private::Pin::new_unchecked(_0), - ::pin_project::__private::Pin::new_unchecked(_1), + _pin_project::__private::Pin::new_unchecked(_0), + _pin_project::__private::Pin::new_unchecked(_1), _2, _3, ) } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __TupleStructProjectionOwned { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self(_0, _1, _2, _3) = &mut *__self_ptr; let __result = __TupleStructProjectionOwned( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_2), - ::pin_project::__private::ptr::read(_3), + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_2), + _pin_project::__private::ptr::read(_3), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_1); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -103,32 +106,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs index 21c1c593..339ce429 100644 --- a/tests/expand/naming/enum-all.expanded.rs +++ b/tests/expand/naming/enum-all.expanded.rs @@ -82,20 +82,23 @@ enum ProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => Proj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - Proj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => Proj::Unit, } @@ -103,49 +106,49 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => ProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - ProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => ProjRef::Unit, } } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = ProjOwn::Struct { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = ProjOwn::Tuple( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -160,32 +163,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-mut.expanded.rs b/tests/expand/naming/enum-mut.expanded.rs index 73243725..09271fdc 100644 --- a/tests/expand/naming/enum-mut.expanded.rs +++ b/tests/expand/naming/enum-mut.expanded.rs @@ -40,20 +40,23 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => Proj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - Proj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => Proj::Unit, } @@ -62,32 +65,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-none.expanded.rs b/tests/expand/naming/enum-none.expanded.rs index 34100017..54cd1f8c 100644 --- a/tests/expand/naming/enum-none.expanded.rs +++ b/tests/expand/naming/enum-none.expanded.rs @@ -18,39 +18,42 @@ enum Enum { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum {} #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-own.expanded.rs b/tests/expand/naming/enum-own.expanded.rs index a63a8746..a606e55c 100644 --- a/tests/expand/naming/enum-own.expanded.rs +++ b/tests/expand/naming/enum-own.expanded.rs @@ -38,39 +38,42 @@ enum ProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = ProjOwn::Struct { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = ProjOwn::Tuple( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -85,32 +88,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-ref.expanded.rs b/tests/expand/naming/enum-ref.expanded.rs index 61975578..4565d084 100644 --- a/tests/expand/naming/enum-ref.expanded.rs +++ b/tests/expand/naming/enum-ref.expanded.rs @@ -40,23 +40,26 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => ProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - ProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => ProjRef::Unit, } @@ -65,32 +68,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index 54b63f56..24a5d9dd 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -64,49 +64,52 @@ struct ProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Struct { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); Proj { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); ProjRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = ProjOwn { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } @@ -119,31 +122,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index ee641d6d..5803d6b2 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -32,10 +32,13 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::ref_option_ref)] struct __StructProjectionRef<'pin, T, U> @@ -46,23 +49,23 @@ const _: () = { unpinned: &'pin (U), } impl Struct { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); Proj { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -75,31 +78,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 794675a3..3089a545 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -14,10 +14,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -38,24 +41,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -68,31 +71,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index 28538384..1eb90a5a 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -28,10 +28,13 @@ struct ProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -52,45 +55,45 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = ProjOwn { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } @@ -103,31 +106,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index baee3240..c131ec49 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -32,10 +32,13 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -47,24 +50,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); ProjRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -77,31 +80,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 125d4835..96650c7a 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -49,43 +49,46 @@ struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl TupleStruct { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - Proj(::pin_project::__private::Pin::new_unchecked(_0), _1) + Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - ProjRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self(_0, _1) = &mut *__self_ptr; let __result = ProjOwn( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -98,31 +101,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index f7daaff7..60218d6c 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -24,10 +24,13 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::ref_option_ref)] struct __TupleStructProjectionRef<'pin, T, U>( @@ -37,19 +40,19 @@ const _: () = { where TupleStruct: 'pin; impl TupleStruct { - fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - Proj(::pin_project::__private::Pin::new_unchecked(_0), _1) + Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -60,31 +63,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index 6a3dfbfe..cc9b75e6 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -32,20 +35,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -56,31 +59,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 5f180452..9c374110 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -21,10 +21,13 @@ struct ProjOwn(::pin_project::__private::PhantomData, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -43,39 +46,39 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self(_0, _1) = &mut *__self_ptr; let __result = ProjOwn( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -88,31 +91,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index d8d5008b..ea11b6a2 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -24,10 +24,13 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -38,20 +41,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - ProjRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -62,31 +65,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs index 3414a10d..5173b545 100644 --- a/tests/expand/not_unpin/enum.expanded.rs +++ b/tests/expand/not_unpin/enum.expanded.rs @@ -62,22 +62,25 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -85,40 +88,40 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } } } } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index b701af5a..e9d89225 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -14,10 +14,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -38,24 +41,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -66,24 +69,24 @@ const _: () = { let _ = &this.pinned; let _ = &this.unpinned; } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index 4b734837..cefb61db 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -32,20 +35,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -54,24 +57,24 @@ const _: () = { let _ = &this.0; let _ = &this.1; } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: - ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: + _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index a968b724..e1bc486b 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -63,22 +63,25 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -86,16 +89,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -104,30 +107,30 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } - impl ::pin_project::__private::Drop for Enum { + impl _pin_project::__private::Drop for Enum { fn drop(&mut self) { unsafe { - let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); - ::pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); + _pin_project::__private::PinnedDrop::drop(__pinned_self); } } } diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 630389bb..22274429 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -15,10 +15,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -39,24 +42,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -69,29 +72,29 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } - impl ::pin_project::__private::Drop for Struct { + impl _pin_project::__private::Drop for Struct { fn drop(&mut self) { unsafe { - let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); - ::pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); + _pin_project::__private::PinnedDrop::drop(__pinned_self); } } } diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index f06f2ae9..8c7433e7 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -11,10 +11,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -33,20 +36,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -57,29 +60,29 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } - impl ::pin_project::__private::Drop for TupleStruct { + impl _pin_project::__private::Drop for TupleStruct { fn drop(&mut self) { unsafe { - let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); - ::pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); + _pin_project::__private::PinnedDrop::drop(__pinned_self); } } } diff --git a/tests/expand/project_replace/enum.expanded.rs b/tests/expand/project_replace/enum.expanded.rs index 27ff08a8..a0744be2 100644 --- a/tests/expand/project_replace/enum.expanded.rs +++ b/tests/expand/project_replace/enum.expanded.rs @@ -38,39 +38,42 @@ enum EnumProjOwn { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> EnumProjOwn { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = EnumProjOwn::Struct { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = EnumProjOwn::Tuple( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -85,32 +88,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index bad49844..321318bd 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -14,10 +14,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -43,45 +46,45 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = __StructProjectionOwned { - pinned: ::pin_project::__private::PhantomData, - unpinned: ::pin_project::__private::ptr::read(unpinned), + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), }; { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } @@ -94,31 +97,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index bc5a6e57..e09e08a2 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -34,39 +37,39 @@ const _: () = { struct __TupleStructProjectionOwned(::pin_project::__private::PhantomData, U); impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: ::pin_project::__private::Pin<&mut Self>, + self: _pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __TupleStructProjectionOwned { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + let __guard = _pin_project::__private::UnsafeOverwriteGuard { target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), + value: _pin_project::__private::ManuallyDrop::new(__replacement), }; let Self(_0, _1) = &mut *__self_ptr; let __result = __TupleStructProjectionOwned( - ::pin_project::__private::PhantomData, - ::pin_project::__private::ptr::read(_1), + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), ); { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -79,31 +82,31 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs index f9bd9fe9..530eca94 100644 --- a/tests/expand/pub/enum.expanded.rs +++ b/tests/expand/pub/enum.expanded.rs @@ -62,22 +62,25 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { pub(crate) fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -85,16 +88,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -103,32 +106,32 @@ const _: () = { } #[allow(missing_debug_implementations)] pub struct __Enum<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum where - __Enum<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum where + __Enum<'pin, T, U>: _pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index 8abd9a1c..71ae3a3b 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -14,10 +14,13 @@ pub struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] pub(crate) struct __StructProjection<'pin, T, U> @@ -38,24 +41,24 @@ const _: () = { } impl Struct { pub(crate) fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -68,31 +71,31 @@ const _: () = { } #[allow(missing_debug_implementations)] pub struct __Struct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct where - __Struct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct where + __Struct<'pin, T, U>: _pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 2641d167..02c3f24d 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ pub struct TupleStruct(#[pin] pub T, pub U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] pub(crate) struct __TupleStructProjection<'pin, T, U>( @@ -32,20 +35,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { pub(crate) fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -56,31 +59,31 @@ const _: () = { } #[allow(missing_debug_implementations)] pub struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< 'pin, ( - ::pin_project::__private::PhantomData, - ::pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, + _pin_project::__private::PhantomData, ), >, __field0: T, } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct where - __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs index 1c51df05..3d53a1e8 100644 --- a/tests/expand/unsafe_unpin/enum.expanded.rs +++ b/tests/expand/unsafe_unpin/enum.expanded.rs @@ -62,22 +62,25 @@ where #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; impl Enum { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -85,33 +88,33 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } } } } - impl<'pin, T, U> ::pin_project::__private::Unpin for Enum where - ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin + impl<'pin, T, U> _pin_project::__private::Unpin for Enum where + _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl EnumMustNotImplDrop for T {} + impl EnumMustNotImplDrop for T {} impl EnumMustNotImplDrop for Enum {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Enum { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Enum { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl UnsafeUnpin for Enum {} diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index 67ede397..a866ab3c 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -14,10 +14,13 @@ struct Struct { #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __StructProjection<'pin, T, U> @@ -38,24 +41,24 @@ const _: () = { } impl Struct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: ::pin_project::__private::Pin::new_unchecked(pinned), + pinned: _pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } @@ -66,17 +69,17 @@ const _: () = { let _ = &this.pinned; let _ = &this.unpinned; } - impl<'pin, T, U> ::pin_project::__private::Unpin for Struct where - ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin + impl<'pin, T, U> _pin_project::__private::Unpin for Struct where + _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl StructMustNotImplDrop for T {} + impl StructMustNotImplDrop for T {} impl StructMustNotImplDrop for Struct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for Struct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for Struct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl UnsafeUnpin for Struct {} diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 512f1394..1a419768 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -10,10 +10,13 @@ struct TupleStruct(#[pin] T, U); #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] #[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] #[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] struct __TupleStructProjection<'pin, T, U>( @@ -32,20 +35,20 @@ const _: () = { TupleStruct: 'pin; impl TupleStruct { fn project<'pin>( - self: ::pin_project::__private::Pin<&'pin mut Self>, + self: _pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: ::pin_project::__private::Pin<&'pin Self>, + self: _pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) } } } @@ -54,17 +57,17 @@ const _: () = { let _ = &this.0; let _ = &this.1; } - impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct where - ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct where + _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl TupleStructMustNotImplDrop for T {} + impl TupleStructMustNotImplDrop for T {} impl TupleStructMustNotImplDrop for TupleStruct {} #[doc(hidden)] - impl ::pin_project::__private::PinnedDrop for TupleStruct { - unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} + impl _pin_project::__private::PinnedDrop for TupleStruct { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl UnsafeUnpin for Struct {} diff --git a/tests/ui/not_unpin/impl-unsafe-unpin.stderr b/tests/ui/not_unpin/impl-unsafe-unpin.stderr index efc51984..a944e959 100644 --- a/tests/ui/not_unpin/impl-unsafe-unpin.stderr +++ b/tests/ui/not_unpin/impl-unsafe-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` --> tests/ui/not_unpin/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>` --> tests/ui/not_unpin/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>` --> tests/ui/not_unpin/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project(!Unpin)] //~ ERROR E0119 diff --git a/tests/ui/pin_project/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr index 5680daaf..ba423038 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.stderr +++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` --> tests/ui/pin_project/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>` --> tests/ui/pin_project/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>` +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>` --> tests/ui/pin_project/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 diff --git a/tests/ui/pin_project/override-priv-mod.rs b/tests/ui/pin_project/override-priv-mod.rs new file mode 100644 index 00000000..890fd5b8 --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.rs @@ -0,0 +1,32 @@ +// https://discord.com/channels/273534239310479360/512792629516173323/870075511009857617 + +extern crate pin_project as pin_project_orig; +extern crate self as pin_project; + +pub use ::pin_project_orig::*; +mod __private { + pub use ::pin_project_orig::__private::*; + pub trait Drop {} +} + +use std::{marker::PhantomPinned, mem}; + +#[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` +struct S { + #[pin] + f: (u8, PhantomPinned), +} + +impl Drop for S { + fn drop(&mut self) { + let prev = &self.f.0 as *const _ as usize; + let moved = mem::take(&mut self.f); // move pinned field + let moved = &moved.0 as *const _ as usize; + assert_eq!(prev, moved); // panic + } +} + +fn main() { + let mut x = Box::pin(S { f: (1, PhantomPinned) }); + let _f = x.as_mut().project().f; // first mutable access +} diff --git a/tests/ui/pin_project/override-priv-mod.stderr b/tests/ui/pin_project/override-priv-mod.stderr new file mode 100644 index 00000000..8a3fb9b6 --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.stderr @@ -0,0 +1,10 @@ +error[E0119]: conflicting implementations of trait `_::SMustNotImplDrop` for type `S` + --> tests/ui/pin_project/override-priv-mod.rs:14:1 + | +14 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` + | ^^^^^^^^^^^^^^ + | | + | first implementation here + | conflicting implementation for `S` + | + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr index fc4efc9a..25422545 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S` +error[E0119]: conflicting implementations of trait `_::_pin_project::__private::PinnedDrop` for type `S` --> tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs:12:1 | 5 | #[pin_project] diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr index 6add4ab8..20d4e088 100644 --- a/tests/ui/unsafe_unpin/conflict-unpin.stderr +++ b/tests/ui/unsafe_unpin/conflict-unpin.stderr @@ -7,7 +7,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 10 | impl Unpin for Foo where T: Unpin {} | --------------------------------------------- first implementation here | - = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Foo<_, _>>` in future versions + = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Foo<_, _>>` in future versions error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` --> tests/ui/unsafe_unpin/conflict-unpin.rs:12:15 @@ -18,7 +18,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 19 | impl Unpin for Bar {} | ------------------------------ first implementation here | - = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Bar<_, _>>` in future versions + = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Bar<_, _>>` in future versions error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` --> tests/ui/unsafe_unpin/conflict-unpin.rs:21:15 @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 28 | impl Unpin for Baz {} | -------------------------------------------- first implementation here | - = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Baz<_, _>>` in future versions + = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Baz<_, _>>` in future versions