Skip to content

Commit

Permalink
Ignore clippy::forget_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Sep 3, 2022
1 parent 29fb2ff commit 1e9ed35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ pub macro struct_field_offset($ty_name:ident => $ty:ty => (*$base:ident).$field:
#[allow(clippy::cast_sign_loss)]
let offset = unsafe { field_ptr.cast::<u8>().offset_from($base.cast()) as usize };

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

$crate::MaybeUninhabited::Inhabited(offset)
Expand All @@ -572,7 +572,7 @@ pub macro struct_variant_discriminant {
core::mem::transmute(core::mem::discriminant(&uninit))
};

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

let mut big_endian_bytes = [0_u8; core::mem::size_of::<core::mem::Discriminant<$ty>>()];
Expand Down Expand Up @@ -612,7 +612,7 @@ pub macro struct_variant_discriminant {
core::mem::transmute(core::mem::discriminant(&uninit))
};

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

let big_endian_bytes = unsafe {
Expand Down Expand Up @@ -659,7 +659,7 @@ pub macro struct_variant_discriminant {
core::mem::transmute(core::mem::discriminant(&uninit))
};

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

let big_endian_bytes = unsafe {
Expand Down Expand Up @@ -715,7 +715,7 @@ pub macro struct_variant_field_offset {
#[allow(clippy::cast_sign_loss)]
let offset = unsafe { field_ptr.cast::<u8>().offset_from(base_ptr.cast()) as usize };

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

$crate::MaybeUninhabited::Inhabited(offset)
Expand Down Expand Up @@ -746,7 +746,7 @@ pub macro struct_variant_field_offset {
#[allow(clippy::cast_sign_loss)]
let offset = unsafe { field_ptr.cast::<u8>().offset_from(base_ptr.cast()) as usize };

#[allow(clippy::forget_non_drop)]
#[allow(clippy::forget_non_drop, clippy::forget_copy)]
core::mem::forget(uninit);

$crate::MaybeUninhabited::Inhabited(offset)
Expand Down
6 changes: 6 additions & 0 deletions try-crate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ pub struct MyPhantomData<T> {
marker: std::marker::PhantomData<T>,
}

#[derive(TypeLayout)]
#[repr(transparent)]
pub struct Wrapper(f64);

fn main() {
println!("{:#?}", Foo1::TYPE_GRAPH);
println!("{:#?}", Foo2::TYPE_GRAPH);
Expand Down Expand Up @@ -192,6 +196,8 @@ fn main() {
println!("{:#?}", <MutReference<u32>>::TYPE_GRAPH);
println!("{:#?}", <Referencing<&'static u8>>::TYPE_GRAPH);

println!("{:#?}", <Wrapper>::TYPE_GRAPH);

non_static_ref(&0);

println!("{:#?}", <List<u8>>::TYPE_GRAPH);
Expand Down

0 comments on commit 1e9ed35

Please sign in to comment.