From 983cae77dd8681adfb021f841881185721087098 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Wed, 20 Nov 2019 14:40:54 -0500 Subject: [PATCH] Clarify Step Documentation While the redesign is in progress (#62886), clarify the purpose of replace_zero and replace_one. --- src/libcore/iter/range.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index efda3b263cc97..63036f516a0a4 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -20,10 +20,14 @@ pub trait Step: Clone + PartialOrd + Sized { /// without overflow. fn steps_between(start: &Self, end: &Self) -> Option; - /// Replaces this step with `1`, returning itself. + /// Replaces this step with `1`, returning a clone of itself. + /// + /// The output of this method should always be greater than the output of replace_zero. fn replace_one(&mut self) -> Self; - /// Replaces this step with `0`, returning itself. + /// Replaces this step with `0`, returning a clone of itself. + /// + /// The output of this method should always be less than the output of replace_one. fn replace_zero(&mut self) -> Self; /// Adds one to this step, returning the result.