File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -2961,7 +2961,7 @@ pub trait Itertools: Iterator {
2961
2961
use alloc:: collections:: BinaryHeap ;
2962
2962
2963
2963
if k == 0 {
2964
- return vec ! [ ] . into_iter ( ) ;
2964
+ return Vec :: new ( ) . into_iter ( ) ;
2965
2965
}
2966
2966
2967
2967
let mut heap = self . by_ref ( ) . take ( k) . collect :: < BinaryHeap < _ > > ( ) ;
@@ -2997,7 +2997,6 @@ pub trait Itertools: Iterator {
2997
2997
///
2998
2998
/// This corresponds to `self.sorted_by_key(cmp).take(k)` in the same way that
2999
2999
/// [Itertools::k_smallest] corresponds to `self.sorted().take(k)`, in both semantics and time complexity.
3000
- /// This method will use an _additional_ `k * sizeof(K)` memory compared to that method.
3001
3000
#[ cfg( feature = "use_alloc" ) ]
3002
3001
fn k_smallest_by_key < F , K > ( self , k : usize , key : F ) -> VecIntoIter < Self :: Item >
3003
3002
where
Original file line number Diff line number Diff line change @@ -518,19 +518,19 @@ qc::quickcheck! {
518
518
519
519
// Check the variations produce the same answers and that they're right
520
520
for ( a, b, c, d) in izip!(
521
- sorted[ ..num_elements] . iter( ) . cloned( ) ,
522
- smallest,
523
- smallest_by,
521
+ sorted[ ..num_elements] . iter( ) . cloned( ) ,
522
+ smallest,
523
+ smallest_by,
524
524
smallest_by_key) {
525
525
assert_eq!( a, b) ;
526
526
assert_eq!( a, c) ;
527
527
assert_eq!( a, d) ;
528
528
}
529
529
530
530
for ( a, b, c, d) in izip!(
531
- sorted[ sorted. len( ) -num_elements..] . iter( ) . rev( ) . cloned( ) ,
532
- largest,
533
- largest_by,
531
+ sorted[ sorted. len( ) -num_elements..] . iter( ) . rev( ) . cloned( ) ,
532
+ largest,
533
+ largest_by,
534
534
largest_by_key) {
535
535
assert_eq!( a, b) ;
536
536
assert_eq!( a, c) ;
You can’t perform that action at this time.
0 commit comments