Skip to content

Commit 1f057a3

Browse files
committed
Fix overflow panics
1 parent 30b1232 commit 1f057a3

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ clap = { version = "4.0.29", features = ["derive"] }
2525
chrono = "0.4.31"
2626
anyhow = "1.0.75"
2727

28-
2928
[profile.release]
3029
overflow-checks = true
3130
incremental = true

aoc_2021/src/day_10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn part_b(input: &str) -> Answer {
5252
}
5353

5454
if !is_corrupted {
55-
let mut score = 0;
55+
let mut score = 0u64;
5656
while let Some(ch) = queue.pop() {
5757
score = 5 * score
5858
+ match ch {

aoc_2022/src/day_19.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl State {
4747
fn tick(self) -> Self {
4848
let mut resources = self.resources;
4949
for (i, resource) in resources.iter_mut().enumerate() {
50-
*resource += self.robots[i];
50+
*resource = resource.saturating_add(self.robots[i]);
5151
}
5252

5353
Self { resources, ..self }

aoc_2022/src/day_23.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use hashbrown::{hash_map::Entry, HashMap, HashSet};
33
use common::{solution, Answer};
44
use nd_vec::vector;
55

6-
solution!("Unstable Diffusion", 32);
6+
solution!("Unstable Diffusion", 23);
77

88
type Point = nd_vec::Vec2<isize>;
99

0 commit comments

Comments
 (0)