refactor(ast): fix clippy lint on nightly (#3346)

Clippy on nightly produces a warning for `&t as *const _`.

This warning is spurious in this case - we know `t` is valid, because we just created it. But change it, to keep Clippy happy!
This commit is contained in:
overlookmotel 2024-05-18 17:43:51 +00:00
parent 1e802c71d5
commit 938ae12203

View file

@ -931,10 +931,10 @@ pub(crate) use shared_enum_variants;
/// <https://doc.rust-lang.org/std/mem/fn.discriminant.html>
macro_rules! discriminant {
($ty:ident :: $variant:ident) => {{
#[allow(unsafe_code, clippy::ptr_as_ptr, clippy::undocumented_unsafe_blocks)]
#[allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
unsafe {
let t = std::mem::ManuallyDrop::new($ty::$variant(oxc_allocator::Box::dangling()));
*(&t as *const _ as *const u8)
*(std::ptr::addr_of!(t).cast::<u8>())
}
}};
}