Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Sep 21, 2020
1 parent fc152cd commit 85b2d9b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/core/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ fn test_zip_next_back_side_effects_exhausted() {
#[derive(Debug)]
struct CountClone(Cell<i32>);

fn count_clone() -> CountClone { CountClone(Cell::new(0)) }
fn count_clone() -> CountClone {
CountClone(Cell::new(0))
}

impl PartialEq<i32> for CountClone {
fn eq(&self, rhs: &i32) -> bool {
Expand All @@ -401,15 +403,15 @@ fn test_zip_cloned_sideffectful() {
let xs = [count_clone(), count_clone(), count_clone(), count_clone()];
let ys = [count_clone(), count_clone()];

for _ in xs.iter().cloned().zip(ys.iter().cloned()) { }
for _ in xs.iter().cloned().zip(ys.iter().cloned()) {}

assert_eq!(&xs, &[1, 1, 1, 0][..]);
assert_eq!(&ys, &[1, 1][..]);

let xs = [count_clone(), count_clone()];
let ys = [count_clone(), count_clone(), count_clone(), count_clone()];

for _ in xs.iter().cloned().zip(ys.iter().cloned()) { }
for _ in xs.iter().cloned().zip(ys.iter().cloned()) {}

assert_eq!(&xs, &[1, 1][..]);
assert_eq!(&ys, &[1, 1, 0, 0][..]);
Expand All @@ -420,15 +422,15 @@ fn test_zip_map_sideffectful() {
let mut xs = [0; 6];
let mut ys = [0; 4];

for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { }
for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) {}

assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]);
assert_eq!(&ys, &[1, 1, 1, 1]);

let mut xs = [0; 4];
let mut ys = [0; 6];

for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { }
for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) {}

assert_eq!(&xs, &[1, 1, 1, 1]);
assert_eq!(&ys, &[1, 1, 1, 1, 0, 0]);
Expand Down

0 comments on commit 85b2d9b

Please sign in to comment.