accumulate into vector and assert, instead of printing

I'm only making this change in one place so that people can express
their preferences for this stylistic change. If/when this change is
approved I'll go ahead and translate the rest of the `std::ops`
examples.
This commit is contained in:
Matthew Piziak 2016-08-15 18:03:11 -04:00
parent 11f8805887
commit c9f2055110

View File

@ -295,20 +295,8 @@ impl<A: Step> ops::Range<A> {
///
/// ```
/// #![feature(step_by)]
///
/// for i in (0..10).step_by(2) {
/// println!("{}", i);
/// }
/// ```
///
/// This prints:
///
/// ```text
/// 0
/// 2
/// 4
/// 6
/// 8
/// let result: Vec<_> = (0..10).step_by(2).take(10).collect();
/// assert_eq!(result, vec![0, 2, 4, 6, 8]);
/// ```
#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
@ -650,4 +638,3 @@ impl<A: Step> DoubleEndedIterator for ops::RangeInclusive<A> where
n
}
}