Skip to content

Commit b0443e0

Browse files
committed
k_smallest: Clarify what happens when self.len() < k
1 parent 11b54cc commit b0443e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,8 @@ pub trait Itertools : Iterator {
22892289
/// Sort the k smallest elements into a new iterator, in ascending order.
22902290
///
22912291
/// **Note:** This consumes the entire iterator, and returns the result
2292-
/// as a new iterator that owns its elements.
2292+
/// as a new iterator that owns its elements. If the input contains
2293+
/// less than k elements, the result is equivalent to `self.sorted()`.
22932294
///
22942295
/// This is guaranteed to use `k * sizeof(Self::Item) + O(1)` memory
22952296
/// and `O(n log k)` time, with `n` the number of elements in the input.

0 commit comments

Comments
 (0)