refactor: clippy
This commit is contained in:
parent
12c2f9d1b3
commit
f7a94ac9e1
16
src/main.rs
16
src/main.rs
|
@ -17,18 +17,16 @@ struct Args {
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
if args.targets.len() == 0 {
|
if args.targets.is_empty() {
|
||||||
println!("{} {}", "error:".red().bold(), "no arguents passed");
|
println!("{} no arguments passed", "error:".red().bold());
|
||||||
println!("{} {}", "note:".cyan().bold(), "try 'vpr -h' for more information");
|
println!("{} try 'vpr -h' for more information", "note:".cyan().bold());
|
||||||
process::exit(0);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for target in args.targets.iter() {
|
for target in args.targets.iter() {
|
||||||
if args.no_preserve == false {
|
if !args.no_preserve && (target == "/" || target == "~") {
|
||||||
if target == "/" || target == "~" {
|
println!("{} you're trying to delete an important directory ({})! specify '{}' if you really want to do this", "error:".red().bold(), "--no-preserve".yellow(), target);
|
||||||
println!("{} you're trying to delete an important directory ({})! specify '{}' if you really want to do this", "error:".red().bold(), "--no-preserve".yellow(), target);
|
process::exit(0);
|
||||||
process::exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if path::Path::new(target).exists() {
|
if path::Path::new(target).exists() {
|
||||||
|
@ -38,7 +36,7 @@ fn main() -> std::io::Result<()> {
|
||||||
let _ = fs::remove_file(target);
|
let _ = fs::remove_file(target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{} {} {}", "error:".red().bold(), "the specified target does not exist:", target.yellow());
|
println!("{} the specified target does not exist {}", "error:".red().bold(), target.yellow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue