Skip to content

Commit 6cb62b6

Browse files
committed
pin_init: allow nonstandard_style for generated identifiers
Allows `nonstandard_style` lint on locally generated identifiers in `pin_init!`. Since the same warning will be reported by the compiler on the struct definition, having the extra warning emitted at the macro call site is unnecessary and confusing. Suggested-by: Gary Guo <gary@garyguo.net> Link: #125 Signed-off-by: Mirko Adzic <adzicmirko97@gmail.com>
1 parent d4e1179 commit 6cb62b6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

internal/src/pin_data.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ fn generate_unpin_impl(
164164
quote! {
165165
// This struct will be used for the unpin analysis. It is needed, because only structurally
166166
// pinned fields are relevant whether the struct should implement `Unpin`.
167-
#[allow(dead_code)] // The fields below are never used.
167+
#[allow(
168+
dead_code, // The fields below are never used.
169+
nonstandard_style // The warning will be emitted on the struct definition.
170+
)]
168171
struct __Unpin #generics_with_pin_lt
169172
#where_token
170173
#predicates
@@ -302,7 +305,9 @@ fn generate_projections(
302305
let docs = format!(" Pin-projections of [`{ident}`]");
303306
quote! {
304307
#[doc = #docs]
305-
#[allow(dead_code)]
308+
// Allow `nonstandard_style` since the same warning will be emitted on
309+
// the struct definition.
310+
#[allow(dead_code, nonstandard_style)]
306311
#[doc(hidden)]
307312
#vis struct #projection #generics_with_pin_lt {
308313
#(#fields_decl)*
@@ -395,6 +400,9 @@ fn generate_the_pin_data(
395400
/// to deallocate.
396401
#pin_safety
397402
#(#attrs)*
403+
// Allow `nonstandard_style` since the same warning will be emitted on
404+
// the struct definition.
405+
#[allow(nonstandard_style)]
398406
#vis unsafe fn #ident<E>(
399407
self,
400408
slot: *mut #ty,

0 commit comments

Comments
 (0)