Skip to content

Commit

Permalink
chore: remove a stabilized impl_core function
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Sep 26, 2024
1 parent 9152d91 commit 851824b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 1 addition & 2 deletions crates/dyn-abi/src/specifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use parser::{ParameterSpecifier, Parameters, RootType, TupleSpecifier, TypeSpeci
#[cfg(feature = "eip712")]
use alloy_json_abi::InternalType;

/// Trait for items that can be resolved to `DynSol_____`, i.e. they specify some Solidity interface
/// Trait for items that can be resolved to `DynSol*`, i.e. they specify some Solidity interface
/// item.
///
/// The `Specifier` trait is implemented by types that can be resolved into Solidity interface
Expand Down Expand Up @@ -38,7 +38,6 @@ use alloy_json_abi::InternalType;
/// assert_eq!("bytes32".resolve()?, DynSolType::FixedBytes(32));
/// # Ok::<_, alloy_dyn_abi::Error>(())
/// ```

pub trait Specifier<T> {
/// Resolve the type into a value.
fn resolve(&self) -> Result<T>;
Expand Down
10 changes: 1 addition & 9 deletions crates/sol-types/src/impl_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ where
Ok(unsafe { array_assume_init(array) })
}

/// [`array::split_array_ref`]
#[inline]
#[track_caller]
pub(crate) fn split_array_ref<T, const N: usize>(slice: &[T]) -> (&[T; N], &[T]) {
let (a, b) = slice.split_at(N);
// SAFETY: a points to [T; N]? Yes it's [T] of length N (checked by split_at)
unsafe { (&*a.as_ptr().cast::<[T; N]>(), b) }
}

/// [`MaybeUninit::slice_assume_init_mut`]
#[inline(always)]
unsafe fn slice_assume_init_mut<T>(slice: &mut [MaybeUninit<T>]) -> &mut [T] {
Expand Down Expand Up @@ -98,6 +89,7 @@ unsafe fn transpose<T, const N: usize>(array: [MaybeUninit<T>; N]) -> MaybeUnini
mem::transmute_copy::<[MaybeUninit<T>; N], MaybeUninit<[T; N]>>(&mem::ManuallyDrop::new(&array))
}

// TODO(MSRV-1.80): remove
/// [`Vec::into_flattened`].
#[inline]
pub(crate) fn into_flattened<T, const N: usize>(vec: Vec<[T; N]>) -> Vec<T> {
Expand Down
2 changes: 1 addition & 1 deletion crates/sol-types/src/types/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub trait SolInterface: Sized {
if data.len() < Self::MIN_DATA_LENGTH.saturating_add(4) {
Err(crate::Error::type_check_fail(data, Self::NAME))
} else {
let (selector, data) = crate::impl_core::split_array_ref(data);
let (selector, data) = data.split_first_chunk().unwrap();
Self::abi_decode_raw(*selector, data, validate)
}
}
Expand Down

0 comments on commit 851824b

Please sign in to comment.