Rust Day 7 - Better cd /
This commit is contained in:
parent
a296f62b58
commit
ec9f1e92bc
2 changed files with 4 additions and 6 deletions
|
@ -9,9 +9,8 @@ pub(crate) fn part_1(input: &Vec<ConsoleLine>) -> usize {
|
|||
for line in input {
|
||||
match line {
|
||||
ConsoleLine::MoveRoot => {
|
||||
while current_directory.len() > 1 {
|
||||
current_directory.pop();
|
||||
}
|
||||
current_directory.clear();
|
||||
current_directory.push("");
|
||||
}
|
||||
ConsoleLine::MoveUp => {
|
||||
current_directory.pop();
|
||||
|
|
|
@ -11,9 +11,8 @@ pub(crate) fn part_2(input: &Vec<ConsoleLine>) -> usize {
|
|||
for line in input {
|
||||
match line {
|
||||
ConsoleLine::MoveRoot => {
|
||||
while current_directory.len() > 1 {
|
||||
current_directory.pop();
|
||||
}
|
||||
current_directory.clear();
|
||||
current_directory.push("");
|
||||
}
|
||||
ConsoleLine::MoveUp => {
|
||||
current_directory.pop();
|
||||
|
|
Loading…
Reference in a new issue