From 8e4b2f25976cff49d51a573454d1a3902f3ef28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= Date: Wed, 2 May 2018 10:24:24 +0200 Subject: [PATCH] Fix after using clippy --- src/main.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7ec2710..3a2b204 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,7 @@ struct Args { } impl Args { - fn new(matches: ArgMatches) -> Args { + fn new(matches: &ArgMatches) -> Args { let i = matches.value_of("source").unwrap(); let o = matches.value_of("dest").unwrap(); @@ -60,11 +60,7 @@ impl Args { } fn check_not_same(&self) -> bool { - if self.input == self.output { - false - } else { - true - } + self.input != self.output } fn check_not_parent(&self) -> bool { @@ -129,20 +125,18 @@ fn main() { .get_matches(); 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 output: {}", args.output); println!("Verbosity Level: {}", args.vlevel); - if args.dryrun == true { + if args.dryrun { println!("dry-run enabled"); - } else { - if args.vlevel >= 2 { - t.fg(term::color::RED).unwrap(); - println!("dry-run not enabled"); - t.reset().unwrap(); - } + } else if args.vlevel >= 2 { + t.fg(term::color::RED).unwrap(); + println!("dry-run not enabled"); + t.reset().unwrap(); } // Check input & output @@ -180,7 +174,7 @@ fn main() { &format!("[{}] - {}", i, entry.path().display())); - i = i+1; + i += 1; } } }