From fc3fc571d29ccec4a4f80da35d5f77e94c6663c3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 10 Jan 2021 14:36:15 +0300 Subject: Cleaner API --- crates/stdx/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/stdx') diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 5aacdb16e..13aab1451 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs @@ -152,13 +152,13 @@ where left } -pub fn equal_range_by(slice: &[T], mut key: F) -> (usize, usize) +pub fn equal_range_by(slice: &[T], mut key: F) -> ops::Range where F: FnMut(&T) -> Ordering, { let start = partition_point(slice, |it| key(it) == Ordering::Less); let len = partition_point(&slice[start..], |it| key(it) == Ordering::Equal); - (start, len) + start..start + len } pub struct JodChild(pub process::Child); -- cgit v1.2.3