From 27b87f7da21181eca85d9e289adde1d3eda912ce Mon Sep 17 00:00:00 2001 From: Beefki Date: Tue, 24 Oct 2017 03:23:55 -0500 Subject: [PATCH] Ran a linter to improve code --- src/config.rs | 6 +++--- src/management.rs | 2 +- src/packagemanager.rs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 26db932..89576cb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,7 +26,7 @@ impl Config { let mut prog = match get { None => { println!("Sorry, your package manager does not support this action"); - std::process::exit(0); + std::process::exit(0) }, Some(vec) => vec, }; @@ -41,7 +41,7 @@ impl Config { child.wait().expect("Failed to wait on package manager"); }, (_, &None) => { - for arg in prog.iter() { + for arg in &prog { let mut child =Command::new(&command) .arg(arg) .spawn() @@ -50,7 +50,7 @@ impl Config { } }, (Some(_), &Some(ref term)) => { - for arg in prog.iter() { + for arg in &prog { let mut child = Command::new(&command) .arg(arg) .arg(term) diff --git a/src/management.rs b/src/management.rs index 4f974e1..9329b04 100644 --- a/src/management.rs +++ b/src/management.rs @@ -24,7 +24,7 @@ impl Management { let man = match man { None => { help(); - std::process::exit(0); + std::process::exit(0) } Some(val) => val, }; diff --git a/src/packagemanager.rs b/src/packagemanager.rs index bcb167d..8fd5c21 100644 --- a/src/packagemanager.rs +++ b/src/packagemanager.rs @@ -91,7 +91,7 @@ impl<'a> PackageManager<'a> { // the current folder. pub fn set_default(&self) -> std::io::Result<()> { let mut file = File::create("default.conf")?; - file.write_all(format!("{}", self.name).as_bytes())?; + file.write_all(self.name.as_bytes())?; Ok(()) } } @@ -100,6 +100,7 @@ impl<'a> PackageManager<'a> { /// Pulls the first line out of the default.conf and loads that. /// If it doesn't recognize the file it will tell the user that there's an /// issue before exiting. +// TODO: Have this delete malformed default.conf pub fn read_default<'a>() -> PackageManager<'a> { let file = File::open("default.conf").unwrap(); let buffered = BufReader::new(file);