From 938ae1220375ea68061313d7c5892db063717176 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Sat, 18 May 2024 17:43:51 +0000 Subject: [PATCH] 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! --- crates/oxc_ast/src/ast/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_ast/src/ast/macros.rs b/crates/oxc_ast/src/ast/macros.rs index a167c80e1..2240e7db0 100644 --- a/crates/oxc_ast/src/ast/macros.rs +++ b/crates/oxc_ast/src/ast/macros.rs @@ -931,10 +931,10 @@ pub(crate) use shared_enum_variants; /// 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::()) } }}; }