A bit of cleanup.
This commit is contained in:
parent
e0cd4c3f98
commit
8bbc7bf653
|
@ -38,7 +38,7 @@ fn initialize_stacks(stacks: &mut [Vec<char>], text: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_stacks(stacks: &mut [Vec<char>], text: &str, step: u8) {
|
fn move_stacks(stacks: &mut [Vec<char>], text: &str, step: u8) {
|
||||||
let fields: Vec<_> = text.split(' ').collect();
|
let fields = text.split(' ').collect::<Vec<_>>();
|
||||||
let count = fields[1].parse::<usize>().unwrap();
|
let count = fields[1].parse::<usize>().unwrap();
|
||||||
let start = fields[3].parse::<usize>().unwrap();
|
let start = fields[3].parse::<usize>().unwrap();
|
||||||
let end = fields[5].parse::<usize>().unwrap();
|
let end = fields[5].parse::<usize>().unwrap();
|
||||||
|
@ -54,9 +54,7 @@ fn move_stacks(stacks: &mut [Vec<char>], text: &str, step: u8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're doing step 1, we're done
|
// if we're doing step 1, we're done
|
||||||
if crane.is_empty() {
|
if crane.is_empty() { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// step 2 logic
|
// step 2 logic
|
||||||
while let Some(item) = crane.pop() {
|
while let Some(item) = crane.pop() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user