@@ -86,12 +86,14 @@ impl GenerateTokens {
86
86
// - https://github.com/rust-lang/rust/issues/63281
87
87
// - https://github.com/taiki-e/pin-project/pull/53#issuecomment-525906867
88
88
// - https://github.com/taiki-e/pin-project/pull/70
89
- #allowed_lints
90
- #[ allow( unused_qualifications) ]
91
- #[ allow( clippy:: needless_lifetimes) ]
92
- #[ allow( clippy:: semicolon_if_nothing_returned) ]
93
- #[ allow( clippy:: use_self) ]
94
- #[ allow( clippy:: used_underscore_binding) ]
89
+ #[ allow(
90
+ unused_qualifications,
91
+ #allowed_lints
92
+ clippy:: needless_lifetimes,
93
+ clippy:: semicolon_if_nothing_returned,
94
+ clippy:: use_self,
95
+ clippy:: used_underscore_binding
96
+ ) ]
95
97
const _: ( ) = {
96
98
#[ allow( unused_extern_crates) ]
97
99
extern crate pin_project as _pin_project;
@@ -107,52 +109,59 @@ impl GenerateTokens {
107
109
/// Returns attributes that should be applied to all generated code.
108
110
fn global_allowed_lints ( ) -> TokenStream {
109
111
quote ! {
110
- # [ allow ( deprecated) ]
111
- # [ allow ( explicit_outlives_requirements) ] // https://github.com/rust-lang/rust/issues/60993
112
- # [ allow ( single_use_lifetimes) ] // https://github.com/rust-lang/rust/issues/55058
113
- # [ allow ( unreachable_pub) ] // This lint warns `pub` field in private struct.
114
- # [ allow ( unused_tuple_struct_fields) ]
112
+ deprecated,
113
+ explicit_outlives_requirements, // https://github.com/rust-lang/rust/issues/60993
114
+ single_use_lifetimes, // https://github.com/rust-lang/rust/issues/55058
115
+ unreachable_pub, // This lint warns `pub` field in private struct.
116
+ unused_tuple_struct_fields,
115
117
// This lint warns of `clippy::*` generated by external macros.
116
118
// We allow this lint for compatibility with older compilers.
117
- #[ allow( clippy:: unknown_clippy_lints) ]
118
- #[ allow( clippy:: pattern_type_mismatch) ]
119
- #[ allow( clippy:: redundant_pub_crate) ] // This lint warns `pub(crate)` field in private struct.
120
- #[ allow( clippy:: type_repetition_in_bounds) ] // https://github.com/rust-lang/rust-clippy/issues/4326
119
+ clippy:: unknown_clippy_lints,
120
+ clippy:: absolute_paths,
121
+ clippy:: min_ident_chars,
122
+ clippy:: pattern_type_mismatch,
123
+ clippy:: pub_with_shorthand,
124
+ clippy:: redundant_pub_crate, // This lint warns `pub(crate)` field in private struct.
125
+ clippy:: single_char_lifetime_names,
126
+ clippy:: type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/4326
121
127
}
122
128
}
123
129
124
130
/// Returns attributes used on projected types.
125
131
fn proj_allowed_lints ( cx : & Context < ' _ > ) -> ( TokenStream , TokenStream , TokenStream ) {
126
- let large_enum_variant = if cx. kind == Enum {
127
- Some ( quote ! {
128
- #[ allow( variant_size_differences) ]
129
- #[ allow( clippy:: large_enum_variant) ]
130
- } )
131
- } else {
132
- None
133
- } ;
134
132
let global_allowed_lints = global_allowed_lints ( ) ;
135
133
let proj_mut_allowed_lints = if cx. project { Some ( & global_allowed_lints) } else { None } ;
136
134
let proj_mut = quote ! {
137
- #proj_mut_allowed_lints
138
- #[ allow( dead_code) ] // This lint warns unused fields/variants.
139
- #[ allow( clippy:: mut_mut) ] // This lint warns `&mut &mut <ty>`.
140
- #[ allow( clippy:: missing_docs_in_private_items) ]
135
+ #[ allow(
136
+ dead_code, // This lint warns unused fields/variants.
137
+ #proj_mut_allowed_lints
138
+ clippy:: missing_docs_in_private_items,
139
+ clippy:: mut_mut // This lint warns `&mut &mut <ty>`.
140
+ ) ]
141
141
} ;
142
142
let proj_ref_allowed_lints = if cx. project_ref { Some ( & global_allowed_lints) } else { None } ;
143
143
let proj_ref = quote ! {
144
- #proj_ref_allowed_lints
145
- #[ allow( dead_code) ] // This lint warns unused fields/variants.
146
- #[ allow( clippy:: ref_option_ref) ] // This lint warns `&Option<&<ty>>`.
147
- #[ allow( clippy:: missing_docs_in_private_items) ]
144
+ #[ allow(
145
+ dead_code, // This lint warns unused fields/variants.
146
+ #proj_ref_allowed_lints
147
+ clippy:: missing_docs_in_private_items,
148
+ clippy:: ref_option_ref // This lint warns `&Option<&<ty>>`.
149
+ ) ]
148
150
} ;
149
151
let proj_own_allowed_lints =
150
152
if cx. project_replace . ident ( ) . is_some ( ) { Some ( & global_allowed_lints) } else { None } ;
153
+ let variant_size_differences = if cx. kind == Enum {
154
+ Some ( quote ! { variant_size_differences, clippy:: large_enum_variant, } )
155
+ } else {
156
+ None
157
+ } ;
151
158
let proj_own = quote ! {
152
- #proj_own_allowed_lints
153
- #[ allow( dead_code) ] // This lint warns unused fields/variants.
154
- #[ allow( clippy:: missing_docs_in_private_items) ]
155
- #large_enum_variant
159
+ #[ allow(
160
+ dead_code, // This lint warns unused fields/variants.
161
+ #proj_own_allowed_lints
162
+ #variant_size_differences
163
+ clippy:: missing_docs_in_private_items
164
+ ) ]
156
165
} ;
157
166
( proj_mut, proj_ref, proj_own)
158
167
}
@@ -808,7 +817,7 @@ fn make_unpin_impl(cx: &Context<'_>) -> TokenStream {
808
817
// `__UnpinStruct` type must also be public.
809
818
// However, we ensure that the user can never actually reference
810
819
// this 'public' type by creating this type in the inside of `const`.
811
- #[ allow( missing_debug_implementations) ]
820
+ #[ allow( missing_debug_implementations, unnameable_types ) ]
812
821
#vis struct #struct_ident #proj_generics #ty_where_clause {
813
822
__pin_project_use_generics: _pin_project:: __private:: AlwaysUnpin <
814
823
#lifetime, ( #( _pin_project:: __private:: PhantomData <#type_params>) , * )
@@ -975,14 +984,14 @@ fn make_proj_impl(
975
984
let mut project_replace = cx. project_replace . span ( ) . map ( |span| {
976
985
// It is enough to only set the span of the signature.
977
986
let sig = quote_spanned ! { span =>
978
- #allow_dead_code
979
- #[ inline]
980
987
#vis fn project_replace(
981
988
self : _pin_project:: __private:: Pin <& mut Self >,
982
989
__replacement: Self ,
983
990
) -> #proj_own_ident #orig_ty_generics
984
991
} ;
985
992
quote ! {
993
+ #allow_dead_code
994
+ #[ inline]
986
995
#sig {
987
996
unsafe {
988
997
let __self_ptr: * mut Self = self . get_unchecked_mut( ) ;
0 commit comments