Cleanup
This commit is contained in:
parent
14fd1ce4a7
commit
953d18e634
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue