Rollup merge of #35695 - matthew-piziak:vec-assert-over-println, r=GuillaumeGomez

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:
Jonathan Turner 2016-08-17 06:25:26 -07:00 committed by GitHub
commit c1e9ea0b2d

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).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
}
}