summaryrefslogtreecommitdiff
path: root/2024_rust/src/bin/day7.rs
diff options
context:
space:
mode:
Diffstat (limited to '2024_rust/src/bin/day7.rs')
-rw-r--r--2024_rust/src/bin/day7.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/2024_rust/src/bin/day7.rs b/2024_rust/src/bin/day7.rs
index d81ad1e..c8e0d17 100644
--- a/2024_rust/src/bin/day7.rs
+++ b/2024_rust/src/bin/day7.rs
@@ -77,11 +77,11 @@ impl Equation {
}
fn sum_solutions(input: &str, ops: &[Operator]) -> u64 {
- let equations: Vec<Equation> = input.lines().map(|l| Equation::parse(l)).collect();
+ let equations: Vec<Equation> = input.lines().map(Equation::parse).collect();
// println!("Equations: {equations:?}");
equations
.iter()
- .filter(|e| e.has_solution(&ops))
+ .filter(|e| e.has_solution(ops))
.map(|e| e.result)
.sum()
}
@@ -114,9 +114,7 @@ fn p2(input: &str) -> String {
Operator {
name: '|',
f: Box::new(|x, y| {
- format!("{}{}", x.to_string(), y.to_string())
- .parse()
- .unwrap()
+ format!("{}{}", x, y).parse().unwrap()
}),
},
];