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 {
29612961 use alloc:: collections:: BinaryHeap ;
29622962
29632963 if k == 0 {
2964- return vec ! [ ] . into_iter ( ) ;
2964+ return Vec :: new ( ) . into_iter ( ) ;
29652965 }
29662966
29672967 let mut heap = self . by_ref ( ) . take ( k) . collect :: < BinaryHeap < _ > > ( ) ;
@@ -2997,7 +2997,6 @@ pub trait Itertools: Iterator {
29972997 ///
29982998 /// This corresponds to `self.sorted_by_key(cmp).take(k)` in the same way that
29992999 /// [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.
30013000 #[ cfg( feature = "use_alloc" ) ]
30023001 fn k_smallest_by_key < F , K > ( self , k : usize , key : F ) -> VecIntoIter < Self :: Item >
30033002 where
Original file line number Diff line number Diff line change @@ -518,19 +518,19 @@ qc::quickcheck! {
518518
519519 // Check the variations produce the same answers and that they're right
520520 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,
524524 smallest_by_key) {
525525 assert_eq!( a, b) ;
526526 assert_eq!( a, c) ;
527527 assert_eq!( a, d) ;
528528 }
529529
530530 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,
534534 largest_by_key) {
535535 assert_eq!( a, b) ;
536536 assert_eq!( a, c) ;
You can’t perform that action at this time.
0 commit comments