Skip to content

Commit c1cfbf8

Browse files
authored
Allow clippy::mem_forget in yoke_derive (#6891)
Fixes #6786
1 parent ab363fb commit c1cfbf8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

utils/yoke/derive/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ fn yokeable_derive_impl(input: &DeriveInput) -> TokenStream2 {
198198
// are the same
199199
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
200200
let ptr: *const Self = (&this as *const Self::Output).cast();
201-
#[allow(forgetting_copy_types, clippy::forget_copy, clippy::forget_non_drop)] // This is a noop if the struct is copy, which Clippy doesn't like
201+
// This is a noop if the struct is copy, which Clippy doesn't like
202+
// Furthermore, restriction lints like mem_forget are usually for first-party code, not custom derives
203+
#[allow(forgetting_copy_types, clippy::forget_copy, clippy::forget_non_drop, clippy::mem_forget)]
202204
mem::forget(this);
203205
ptr::read(ptr)
204206
}
@@ -237,7 +239,9 @@ fn yokeable_derive_impl(input: &DeriveInput) -> TokenStream2 {
237239
// are the same
238240
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
239241
let ptr: *const Self = (&this as *const Self::Output).cast();
240-
#[allow(forgetting_copy_types, clippy::forget_copy, clippy::forget_non_drop)] // This is a noop if the struct is copy, which Clippy doesn't like
242+
// This is a noop if the struct is copy, which Clippy doesn't like
243+
// Furthermore, restriction lints like mem_forget are usually for first-party code, not custom derives
244+
#[allow(forgetting_copy_types, clippy::forget_copy, clippy::forget_non_drop, clippy::mem_forget)]
241245
mem::forget(this);
242246
ptr::read(ptr)
243247
}

0 commit comments

Comments
 (0)