From 5683a7d10c9f8d569ab962fa157f6bf6d19a629f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= Date: Tue, 1 May 2018 22:53:06 +0200 Subject: [PATCH] Cosmetics --- src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 53d484d..7ec2710 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,7 +50,7 @@ impl Args { result = false; println!("Error, input ( {} ) is not a valid directory", self.input); } - + if ! Path::new(&self.output).exists() { result = false; println!("Error, output ({} ) is not a valid directory", self.output); @@ -66,10 +66,10 @@ impl Args { true } } - + fn check_not_parent(&self) -> bool { let vec = vec![&self.input, &self.output]; - + for (i, x) in vec.iter().enumerate() { let mut a = Path::new(x); let tmp = match i { @@ -173,7 +173,7 @@ fn main() { // symlink_metadata does not follow symlink :-] let metadata = fs::symlink_metadata(entry.path()).unwrap(); let ft = metadata.file_type(); - + if ft.is_file() { if let Ok(mut file) = fs::File::open(&entry.path()) { process::(&mut file, @@ -184,7 +184,7 @@ fn main() { } } } - + // let inputs = fs::read_dir(&args.input).unwrap(); // for path in inputs { // let path_str = path.unwrap().path().into_os_string().into_string().unwrap(); @@ -208,6 +208,7 @@ fn main() { fn process(reader: &mut R, name: &str) { let mut sh = D::default(); let mut buffer = [0u8; BUFFER_SIZE]; + loop { let n = match reader.read(&mut buffer) { Ok(n) => n,