From 2de6ea02c08aa93b8e77978622983883ac4daa86 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:07:56 +0000 Subject: [PATCH] refactor(index, traverse): remove unnecessary type annotations (#5650) Follow-on after #5577. These type annotations are not required. Probably they were suggested by clippy. --- 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 d41e95d08..a4b4bdabd 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 e10b6c56c..57e300bb1 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) }; }