From 8bbc7bf653b5a77a8f5d70cd89fd00256174a61f Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Sun, 18 Feb 2024 22:22:37 +0000 Subject: [PATCH] A bit of cleanup. --- 2022/src/day05.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/2022/src/day05.rs b/2022/src/day05.rs index 3ebbcfd..bea5606 100644 --- a/2022/src/day05.rs +++ b/2022/src/day05.rs @@ -38,10 +38,10 @@ fn initialize_stacks(stacks: &mut [Vec], text: &str) { } fn move_stacks(stacks: &mut [Vec], text: &str, step: u8) { - let fields: Vec<_> = text.split(' ').collect(); + let fields = text.split(' ').collect::>(); let count = fields[1].parse::().unwrap(); let start = fields[3].parse::().unwrap(); - let end = fields[5].parse::().unwrap(); + let end = fields[5].parse::().unwrap(); let mut crane = vec![]; for _ in 0..count { @@ -54,9 +54,7 @@ fn move_stacks(stacks: &mut [Vec], text: &str, step: u8) { } // if we're doing step 1, we're done - if crane.is_empty() { - return; - } + if crane.is_empty() { return; } // step 2 logic while let Some(item) = crane.pop() {