1
Fork 0

Stabilize iterator_repeat_with

Fixes #48169
This commit is contained in:
Thayne McCombs 2018-05-29 23:30:16 -06:00
parent 63cd4a39ea
commit 87941b079a
5 changed files with 8 additions and 34 deletions

View file

@ -1722,18 +1722,6 @@ fn test_repeat_with() {
assert_eq!(repeat_with(|| NotClone(42)).size_hint(), (usize::MAX, None));
}
#[test]
fn test_repeat_with_rev() {
let mut curr = 1;
let mut pow2 = repeat_with(|| { let tmp = curr; curr *= 2; tmp })
.rev().take(4);
assert_eq!(pow2.next(), Some(1));
assert_eq!(pow2.next(), Some(2));
assert_eq!(pow2.next(), Some(4));
assert_eq!(pow2.next(), Some(8));
assert_eq!(pow2.next(), None);
}
#[test]
fn test_repeat_with_take() {
let mut it = repeat_with(|| 42).take(3);