Fix after using clippy

master
Benoît Mauduit 2018-05-02 10:24:24 +02:00
parent 5683a7d10c
commit 8e4b2f2597
1 changed files with 9 additions and 15 deletions

View File

@ -24,7 +24,7 @@ struct Args {
} }
impl Args { impl Args {
fn new(matches: ArgMatches) -> Args { fn new(matches: &ArgMatches) -> Args {
let i = matches.value_of("source").unwrap(); let i = matches.value_of("source").unwrap();
let o = matches.value_of("dest").unwrap(); let o = matches.value_of("dest").unwrap();
@ -60,11 +60,7 @@ impl Args {
} }
fn check_not_same(&self) -> bool { fn check_not_same(&self) -> bool {
if self.input == self.output { self.input != self.output
false
} else {
true
}
} }
fn check_not_parent(&self) -> bool { fn check_not_parent(&self) -> bool {
@ -129,20 +125,18 @@ fn main() {
.get_matches(); .get_matches();
t.fg(term::color::GREEN).unwrap(); t.fg(term::color::GREEN).unwrap();
let args = Args::new(matches); let args = Args::new(&matches);
println!("Value for input: {}", args.input); println!("Value for input: {}", args.input);
println!("Value for output: {}", args.output); println!("Value for output: {}", args.output);
println!("Verbosity Level: {}", args.vlevel); println!("Verbosity Level: {}", args.vlevel);
if args.dryrun == true { if args.dryrun {
println!("dry-run enabled"); println!("dry-run enabled");
} else { } else if args.vlevel >= 2 {
if args.vlevel >= 2 { t.fg(term::color::RED).unwrap();
t.fg(term::color::RED).unwrap(); println!("dry-run not enabled");
println!("dry-run not enabled"); t.reset().unwrap();
t.reset().unwrap();
}
} }
// Check input & output // Check input & output
@ -180,7 +174,7 @@ fn main() {
&format!("[{}] - {}", &format!("[{}] - {}",
i, i,
entry.path().display())); entry.path().display()));
i = i+1; i += 1;
} }
} }
} }