From 953d18e6341a64b0696cb24a69b10456775a179d Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Sat, 10 Dec 2022 11:50:20 -0800 Subject: [PATCH] Cleanup --- src/bin/p07.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bin/p07.rs b/src/bin/p07.rs index 52912c5..1f2731e 100644 --- a/src/bin/p07.rs +++ b/src/bin/p07.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use std::fs; use std::io::{self, BufRead, Read}; -use std::path::{PathBuf}; +use std::path::PathBuf; mod parsing { use nom::{ @@ -137,7 +137,7 @@ fn main() { part2(&lines); } -use parsing::{line, Line, Command, Listing}; +use parsing::{line, Command, Line, Listing}; use path_clean::clean; #[derive(Debug)] @@ -148,7 +148,10 @@ struct State { impl State { fn new() -> Self { - State { cur_path: PathBuf::from("/"), filesystem: HashMap::new() } + State { + cur_path: PathBuf::from("/"), + filesystem: HashMap::new(), + } } fn process(&mut self, line: Line) { @@ -159,9 +162,8 @@ impl State { } fn run(&mut self, cmd: Command) { - match cmd { - Command::Ls => {}, - Command::Cd(p) => self.cur_path.push(p), + if let Command::Cd(p) = cmd { + self.cur_path.push(p) } }