diff --git a/src/macros.rs b/src/macros.rs index 3a24901..964e844 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1104,9 +1104,9 @@ macro_rules! __init_internal { // error when fields are missing (since they will be zeroed). We also have to // check that the type actually implements `Zeroable`. $( - fn is_zeroable(ptr: *mut T) {} + fn assert_zeroable(ptr: *mut T) {} // Ensure that the struct is indeed `Zeroable`. - is_zeroable(slot); + assert_zeroable(slot); // SAFETY: The type implements `Zeroable` by the check above. unsafe { ::core::ptr::write_bytes(slot, 0, 1) }; $init_zeroed // this will be `()` if set. @@ -1124,19 +1124,15 @@ macro_rules! __init_internal { // We use unreachable code to ensure that all fields have been mentioned exactly // once, this struct initializer will still be type-checked and complain with a // very natural error message if a field is forgotten/mentioned more than once. - #[allow(unreachable_code, - clippy::diverging_sub_expression, - clippy::redundant_closure_call)] - if false { - (|| { - $crate::__init_internal!(make_initializer: - @slot(slot), - @type_name($t), - @munch_fields($($fields)*,), - @acc(), - ); - })(); - } + #[allow(unreachable_code, clippy::diverging_sub_expression)] + let _ = || { + $crate::__init_internal!(make_initializer: + @slot(slot), + @type_name($t), + @munch_fields($($fields)*,), + @acc(), + ); + }; } Ok(__InitOk) } @@ -1258,7 +1254,7 @@ macro_rules! __init_internal { // get the correct type inference here: unsafe { let mut zeroed = ::core::mem::zeroed(); - // We have to use type inference her to make zeroed have the correct type. This does + // We have to use type inference here to make zeroed have the correct type. This does // not get executed, so it has no effect. ::core::ptr::write($slot, zeroed); zeroed = ::core::mem::zeroed();