From 13205efbc93523a30bb6df5e34211f882f9ba13a Mon Sep 17 00:00:00 2001 From: Robert Kruszewski Date: Thu, 28 Mar 2024 13:54:31 +0000 Subject: [PATCH] less --- vortex-array/src/compute/search_sorted.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/vortex-array/src/compute/search_sorted.rs b/vortex-array/src/compute/search_sorted.rs index 3978dd182d..178d9ff9a9 100644 --- a/vortex-array/src/compute/search_sorted.rs +++ b/vortex-array/src/compute/search_sorted.rs @@ -118,13 +118,6 @@ impl + Len + ?Sized, T> SearchSorted for S { } } -impl IndexOrd for T { - fn index_cmp(&self, idx: &usize, elem: &Scalar) -> Option { - let scalar_a = scalar_at(self, *idx).ok()?; - scalar_a.partial_cmp(elem) - } -} - impl IndexOrd for &dyn Array { fn index_cmp(&self, idx: &usize, elem: &Scalar) -> Option { let scalar_a = scalar_at(*self, *idx).ok()?; @@ -134,13 +127,8 @@ impl IndexOrd for &dyn Array { impl IndexOrd for [T] { fn index_cmp(&self, idx: &usize, elem: &T) -> Option { - self[*idx].partial_cmp(elem) - } -} - -impl Len for T { - fn len(&self) -> usize { - T::len(self) + // SAFETY: Used in search_sorted_by same as the standard library. The search_sorted ensures idx is in bounds + unsafe { self.get_unchecked(*idx) }.partial_cmp(elem) } }