diff --git a/src/history.rs b/src/history.rs index f3f1b98..e46122c 100644 --- a/src/history.rs +++ b/src/history.rs @@ -60,51 +60,48 @@ pub fn undo() -> Result<()> { } println!( - "✅ {}", - format!( - "{}{}{}", - match contents[3] { - "take" => "Take", - "drop" => "Drop", - "switch" => "Switch", - _ => "Unknown", - } - .bold(), - " action undone".green(), - match contents[3] { - "take" => format!( - "{}{}{}{}{}{}{}", - " (".green(), - contents[1].bold(), - ", from ".green(), - contents[0], - " to ".green(), - match contents[2] { - "active" => contents[2].green(), - "inactive" => contents[2].blue(), - _ => contents[2].red(), - } - .bold(), - " slot)".green(), - ), - "drop" => format!( - "{}{}{}{}{}{}{}", - " (".green(), - contents[1].bold(), - ", from ".green(), - match contents[2] { - "active" => contents[2].green(), - "inactive" => contents[2].blue(), - _ => contents[2].red(), - } - .bold(), - " slot to ".green(), - contents[0], - ")".green(), - ), - _ => String::from(""), - } - ) + "✅ {}{}{}", + match contents[3] { + "take" => "Take", + "drop" => "Drop", + "switch" => "Switch", + _ => "Unknown", + } + .bold(), + " action undone".green(), + match contents[3] { + "take" => format!( + "{}{}{}{}{}{}{}", + " (".green(), + contents[1].bold(), + ", from ".green(), + contents[0], + " to ".green(), + match contents[2] { + "active" => contents[2].green(), + "inactive" => contents[2].blue(), + _ => contents[2].red(), + } + .bold(), + " slot)".green(), + ), + "drop" => format!( + "{}{}{}{}{}{}{}", + " (".green(), + contents[1].bold(), + ", from ".green(), + match contents[2] { + "active" => contents[2].green(), + "inactive" => contents[2].blue(), + _ => contents[2].red(), + } + .bold(), + " slot to ".green(), + contents[0], + ")".green(), + ), + _ => String::from(""), + } ); Ok(()) diff --git a/src/inv.rs b/src/inv.rs index 48f9f46..40ce762 100644 --- a/src/inv.rs +++ b/src/inv.rs @@ -36,7 +36,7 @@ pub fn init() -> Result<()> { let _ = io::stdout().flush(); io::stdin().read_line(&mut answer)?; match answer.as_str().trim() { - "y" | "Y" => fs::remove_dir_all(&ventodir)?, + "y" | "Y" => fs::remove_dir_all(ventodir)?, _ => process::exit(0), }; }; @@ -175,9 +175,9 @@ pub fn switch(message: bool) -> Result<()> { let rename_error = "Vento was unable to switch slots. Try running \"vento -i\" and try again"; - fs::rename(&active, &temp).context(rename_error)?; - fs::rename(&inactive, &active).context(rename_error)?; - fs::rename(&temp, &inactive).context(rename_error)?; + fs::rename(active, &temp).context(rename_error)?; + fs::rename(inactive, active).context(rename_error)?; + fs::rename(&temp, inactive).context(rename_error)?; common::history(common::HistoryData { path: PathBuf::new(), diff --git a/src/item.rs b/src/item.rs index d997354..94c18b9 100644 --- a/src/item.rs +++ b/src/item.rs @@ -72,11 +72,11 @@ pub fn take(file: &String, slot: &str, message: bool) -> Result<()> { if sourcepath.is_file() | sourcepath.is_symlink() { // Checks the path's file type - fs::copy(&file, &destpath)?; - fs::remove_file(&file)?; + fs::copy(file, &destpath)?; + fs::remove_file(file)?; } else if sourcepath.is_dir() { let options = CopyOptions::new(); - move_dir(&file, &slotdir, &options)?; + move_dir(file, &slotdir, &options)?; } else { bail!("{}", "No such file or directory".red()); } @@ -161,7 +161,7 @@ pub fn drop(file: &String, slot: &str, dest: PathBuf, message: bool) -> Result<( } else if sourcepath.is_dir() { let destpath: PathBuf = Path::new(&dest).to_path_buf(); let options = CopyOptions::new(); - move_dir(&sourcepath, &destpath, &options)?; + move_dir(&sourcepath, destpath, &options)?; } else { bail!("{}", "No such file or directory".red()); }