Skip to content

Commit e753f30

Browse files
committed
Correct invariant documentation for steps_between
Given that the previous example involves stepping forward from A to B, the equivalent example on this line would make most sense as stepping backward from B to A.
1 parent 4f0c568 commit e753f30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/iter/range.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait Step: Clone + PartialOrd + Sized {
3030
/// For any `a`, `b`, and `n`:
3131
///
3232
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)`
33-
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&a, n) == Some(a)`
33+
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&b, n) == Some(a)`
3434
/// * `steps_between(&a, &b) == Some(n)` only if `a <= b`
3535
/// * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b`
3636
/// * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`;

0 commit comments

Comments
 (0)