cargo fmt

This commit is contained in:
Daniel S. 2020-12-18 03:14:16 +01:00
parent 3a72256177
commit a22fbfbaee
2 changed files with 3 additions and 2 deletions

View File

@ -55,7 +55,7 @@ pub fn solve_part2(input: &Data) -> i64 {
let target: i64 = b.iter().map(|(_, b)| b).product(); let target: i64 = b.iter().map(|(_, b)| b).product();
loop { loop {
let mut cnt = 0; let mut cnt = 0;
let dt: i64= b let dt: i64 = b
.iter() .iter()
.filter_map(|(i, n)| { .filter_map(|(i, n)| {
if (t + i) % n == 0 { if (t + i) % n == 0 {

View File

@ -24,6 +24,7 @@ impl Data {
} }
ret ret
} }
pub fn update(&mut self) { pub fn update(&mut self) {
let mut checked = HashSet::new(); let mut checked = HashSet::new();
let mut next_active = HashSet::new(); let mut next_active = HashSet::new();
@ -37,7 +38,7 @@ impl Data {
} }
let nb = self.count_neighbors(nx, ny, nz); let nb = self.count_neighbors(nx, ny, nz);
let is_active = self.active.contains(&(nx, ny, nz)); let is_active = self.active.contains(&(nx, ny, nz));
if nb == 3 || is_active && nb == 2 { if nb == 3 || is_active && nb == 2 {
next_active.insert((nx, ny, nz)); next_active.insert((nx, ny, nz));
} }
} }