Skip to content

Commit 2b0c911

Browse files
authored
Merge pull request #2779 from pickfire/patch-1
Add simpler method to proposed example
2 parents 7afbf18 + bde6dd9 commit 2b0c911

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

text/2523-cfg-path-version.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ fn make_iter(limit: u8) -> impl Iterator<Item = u8> {
9191
(0..limit).map(move |x| (x..limit)).flatten()
9292
}
9393

94+
// Even better
95+
fn make_iter(limit: u8) -> impl Iterator<Item = u8> {
96+
#[cfg(not(accessible(::std::iter::Flatten)))]
97+
use itertools::Itertools;
98+
(0..limit).map(move |x| (x..limit)).flatten()
99+
}
100+
94101
fn main() {
95102
println!("{:?}", make_iter(10).collect::<Vec<_>>());
96103
}

0 commit comments

Comments
 (0)