From 8736e99c3a3761ae68c4582f619964fd4ab79b8e Mon Sep 17 00:00:00 2001 From: Adrian Wannenmacher Date: Sun, 24 Sep 2023 14:49:18 +0200 Subject: [PATCH] rethink abort conditions --- src/main.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 795b18d..5cc1353 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,19 +38,19 @@ fn fs_entry(entry: &Path, summary: &mut Summary) { let display = entry.display(); if !entry.exists() && !entry.is_symlink() { print_root_err(format!("{display} doesn't exist")); + return; } - let meta = match entry.symlink_metadata() { - Ok(meta) => meta, + match entry.symlink_metadata() { + Ok(meta) => { + summary.add_user(meta.st_uid()); + summary.add_group(meta.st_gid()); + } Err(e) => { print_err(e, format!("failed to get metadata for {display}")); - return; } }; - summary.add_user(meta.st_uid()); - summary.add_group(meta.st_gid()); - if entry.is_dir() { let children = match read_dir(entry) { Ok(children) => children, @@ -63,10 +63,7 @@ fn fs_entry(entry: &Path, summary: &mut Summary) { for child in children { match child { Ok(child) => fs_entry(&child.path(), summary), - Err(e) => { - print_err(e, format!("invalid child for {display}")); - return; - } + Err(e) => print_err(e, format!("invalid child for {display}")), } } }