mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Formatting for let else now exists
This commit is contained in:
@@ -110,10 +110,15 @@ impl BluePrint {
|
||||
if u32::from(best - got) >= ideal_from_now {
|
||||
continue;
|
||||
}
|
||||
assert!(todo.len() <= 1_000_000, "Safety: got a todo list of len {}, best: {best}",
|
||||
todo.len());
|
||||
assert!(
|
||||
todo.len() <= 1_000_000,
|
||||
"Safety: got a todo list of len {}, best: {best}",
|
||||
todo.len()
|
||||
);
|
||||
for (element, &costs) in self.costs.iter().enumerate() {
|
||||
let Some(min_to_build) = self.until_buildable(costs, resources, machines) else { break };
|
||||
let Some(min_to_build) = self.until_buildable(costs, resources, machines) else {
|
||||
break;
|
||||
};
|
||||
|
||||
// +1 because we need a turn to build
|
||||
let built_after = min_to_build + 1;
|
||||
|
||||
@@ -136,7 +136,9 @@ pub fn part1(input: &[u8]) -> Result<String> {
|
||||
pub fn part2(input: &[u8]) -> Result<String> {
|
||||
let monkeys = parse_input(input, parse_monkeys)?;
|
||||
|
||||
let Monkey::Operation(first, second, _) = &monkeys[&b"root"[..]] else { anyhow::bail!("root is a literal somehow")};
|
||||
let Monkey::Operation(first, second, _) = &monkeys[&b"root"[..]] else {
|
||||
anyhow::bail!("root is a literal somehow")
|
||||
};
|
||||
|
||||
let result = match (evaluate2(&monkeys, first), evaluate2(&monkeys, second)) {
|
||||
(Ok(_), Ok(_)) => anyhow::bail!("both arms succeeded"),
|
||||
|
||||
Reference in New Issue
Block a user