Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions aoclp/src/looping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ where
let prefix_len = self.prefix.len();
self.prefix.nth(n).or_else(|| {
self.cycle_pos = min(self.cycle_pos + (n - prefix_len), self.cycle_size);
(self.cycle_len() != 0)
.then(|| self.next())
.unwrap_or_default()
if self.cycle_len() != 0 {
self.next()
} else {
None
}
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions aoclp_solutions/src/y2017/day_09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ impl Group {

match chars.next() {
Some('{') => (),
Some(c) => panic!("invalid starting character in stream: {}", c),
Some(c) => panic!("invalid starting character in stream: {c}"),
None => panic!("empty stream"),
}

let root = Self::parse(&mut chars, 0);

if let Some(c) = chars.next() {
panic!("invalid character after outermost group in stream: {}", c);
panic!("invalid character after outermost group in stream: {c}");
}

root
Expand Down Expand Up @@ -67,7 +67,7 @@ impl Group {
'{' => group.children.push(Self::parse(chars, group.score())),
'}' => return group,
',' => (),
_ => panic!("invalid non-garbage character found in stream: {}", c),
_ => panic!("invalid non-garbage character found in stream: {c}"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion aoclp_solutions/src/y2017/day_14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Disk {
let input = input();
Self {
hashes: (0..128)
.map(|row| KnotHash::new(format!("{}-{}", input, row)))
.map(|row| KnotHash::new(format!("{input}-{row}")))
.collect(),
}
}
Expand Down
Loading