From 10174a291554423850c584b57653dad3cd450b63 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 12 Nov 2023 14:32:07 +0100 Subject: [PATCH] Formatting for let else now exists --- 2022/src/day19.rs | 11 ++++++++--- 2022/src/day21.rs | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/2022/src/day19.rs b/2022/src/day19.rs index 3716251..58a64bd 100644 --- a/2022/src/day19.rs +++ b/2022/src/day19.rs @@ -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; diff --git a/2022/src/day21.rs b/2022/src/day21.rs index da8ec82..f1291f1 100644 --- a/2022/src/day21.rs +++ b/2022/src/day21.rs @@ -136,7 +136,9 @@ pub fn part1(input: &[u8]) -> Result { pub fn part2(input: &[u8]) -> Result { 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"),