Skip to content

Commit 9ae565d

Browse files
committed
Simplifying generic parameters in k_smallest_general
1 parent 31ae8bf commit 9ae565d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/k_smallest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use alloc::vec::Vec;
22
use core::cmp::{Ordering, Reverse};
33

44
/// Consumes a given iterator, returning the minimum elements in **ascending** order.
5-
pub(crate) fn k_smallest_general<T, I: Iterator<Item = T>, F: FnMut(&T, &T) -> Ordering>(
5+
pub(crate) fn k_smallest_general<I: Iterator, F: FnMut(&I::Item, &I::Item) -> Ordering>(
66
mut iter: I,
77
k: usize,
88
mut comparator: F,
9-
) -> Vec<T> {
9+
) -> Vec<I::Item> {
1010
if k == 0 {
1111
return Vec::new();
1212
}
13-
let mut storage: Vec<T> = iter.by_ref().take(k).collect();
13+
let mut storage: Vec<I::Item> = iter.by_ref().take(k).collect();
1414

1515
// Rearrange the into a valid heap by reordering from the second-bottom-most layer up
1616
// Slightly faster than ordering on each insert, but only by a factor of lg(k)

0 commit comments

Comments
 (0)