8 let ys = xs.iter().cloned().inspect(|_| n += 1).collect::<Vec<usize>>();
10 assert_eq!(n, xs.len());
11 assert_eq!(&xs[..], &ys[..]);
15 fn test_inspect_fold() {
16 let xs = [1, 2, 3, 4];
19 let it = xs.iter().inspect(|_| n += 1);
20 let i = it.fold(0, |i, &x| {
24 assert_eq!(i, xs.len());
26 assert_eq!(n, xs.len());
30 let it = xs.iter().inspect(|_| n += 1);
31 let i = it.rfold(xs.len(), |i, &x| {
32 assert_eq!(x, xs[i - 1]);
37 assert_eq!(n, xs.len());