From bd5b80e7cd2ce4a5735ada1e98f8a953bec0bac5 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Mon, 9 Sep 2024 14:35:54 +0100 Subject: [PATCH] refactor(index, traverse): remove unnecessary type annotations --- crates/oxc_index/src/idxslice.rs | 6 ++---- crates/oxc_traverse/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/oxc_index/src/idxslice.rs b/crates/oxc_index/src/idxslice.rs index d41e95d08ec0ad..a4b4bdabd060c7 100644 --- a/crates/oxc_index/src/idxslice.rs +++ b/crates/oxc_index/src/idxslice.rs @@ -74,16 +74,14 @@ impl IndexSlice { #[inline(always)] pub fn from_slice(s: &[T]) -> &Self { // SAFETY: `IndexSlice` is a thin wrapper around `[T]` with the added marker for the index. - - unsafe { &*(core::ptr::from_ref::<[T]>(s) as *const Self) } + unsafe { &*(core::ptr::from_ref(s) as *const Self) } } /// Construct a new mutable IdxSlice by wrapping an existing mutable slice. #[inline(always)] pub fn from_slice_mut(s: &mut [T]) -> &mut Self { // SAFETY: `IndexSlice` is a thin wrapper around `[T]` with the added marker for the index. - - unsafe { &mut *(core::ptr::from_mut::<[T]>(s) as *mut Self) } + unsafe { &mut *(core::ptr::from_mut(s) as *mut Self) } } /// Copies `self` into a new `IndexVec`. diff --git a/crates/oxc_traverse/src/lib.rs b/crates/oxc_traverse/src/lib.rs index e10b6c56cda6a5..57e300bb1f2d67 100644 --- a/crates/oxc_traverse/src/lib.rs +++ b/crates/oxc_traverse/src/lib.rs @@ -161,5 +161,5 @@ pub fn walk_program<'a, Tr: Traverse<'a>>( ctx: &mut TraverseCtx<'a>, ) { // SAFETY: Walk functions are constructed to avoid unsoundness - unsafe { walk::walk_program(traverser, std::ptr::from_mut::(program), ctx) }; + unsafe { walk::walk_program(traverser, std::ptr::from_mut(program), ctx) }; }