Skip to content

Commit 9163321

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#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.
2 parents 9126b08 + 2c9a1d9 commit 9163321

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/libcore/iter/range.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,8 @@ impl<A: Step> ops::Range<A> {
295295
///
296296
/// ```
297297
/// #![feature(step_by)]
298-
///
299-
/// for i in (0..10).step_by(2) {
300-
/// println!("{}", i);
301-
/// }
302-
/// ```
303-
///
304-
/// This prints:
305-
///
306-
/// ```text
307-
/// 0
308-
/// 2
309-
/// 4
310-
/// 6
311-
/// 8
298+
/// let result: Vec<_> = (0..10).step_by(2).collect();
299+
/// assert_eq!(result, vec![0, 2, 4, 6, 8]);
312300
/// ```
313301
#[unstable(feature = "step_by", reason = "recent addition",
314302
issue = "27741")]
@@ -650,4 +638,3 @@ impl<A: Step> DoubleEndedIterator for ops::RangeInclusive<A> where
650638
n
651639
}
652640
}
653-

0 commit comments

Comments
 (0)