diff options
| author | David Thompson <dhwthompson@gmail.com> | 2021-07-14 13:48:18 -0700 |
|---|---|---|
| committer | David Thompson <dhwthompson@gmail.com> | 2021-07-14 13:48:18 -0700 |
| commit | e753f305439c7c6cb7f485b6c52f930aefaa2a77 (patch) | |
| tree | 641136f12ce4beb544cff2f75a137169a6eab2df | |
| parent | 4f0c568785adcc0a123cac9d47047020b7a24821 (diff) | |
| download | rust-e753f305439c7c6cb7f485b6c52f930aefaa2a77.tar.gz rust-e753f305439c7c6cb7f485b6c52f930aefaa2a77.zip | |
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.
| -rw-r--r-- | library/core/src/iter/range.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/iter/range.rs b/library/core/src/iter/range.rs index 4a86d6a100a..b9387ef49e5 100644 --- a/library/core/src/iter/range.rs +++ b/library/core/src/iter/range.rs @@ -30,7 +30,7 @@ pub trait Step: Clone + PartialOrd + Sized { /// For any `a`, `b`, and `n`: /// /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)` - /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&a, n) == Some(a)` + /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&b, n) == Some(a)` /// * `steps_between(&a, &b) == Some(n)` only if `a <= b` /// * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b` /// * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`; |
