diff --git a/src/util_file.rs b/src/util_file.rs index d9fb589..e14694d 100644 --- a/src/util_file.rs +++ b/src/util_file.rs @@ -82,11 +82,8 @@ fn walk_dir_with_depth_check(depth: &mut u32, dir: &P } else if sub_dir.is_dir() { if func_filter_dir(&sub_dir) { *depth += 1; - match walk_dir_with_depth_check(depth, &sub_dir, func_walk_error, func_process_file, func_filter_dir) { - Err(err) => { - func_walk_error(&sub_dir, err); - }, - Ok(_) => (), + if let Err(err) = walk_dir_with_depth_check(depth, &sub_dir, func_walk_error, func_process_file, func_filter_dir) { + func_walk_error(&sub_dir, err); } *depth -= 1; } diff --git a/src/util_msg.rs b/src/util_msg.rs index f8a92ae..0bb5951 100644 --- a/src/util_msg.rs +++ b/src/util_msg.rs @@ -15,20 +15,18 @@ pub fn is_atty() -> bool{ pub fn print_color(color: Option, is_bold: bool, m: &str) { let mut t = term::stdout().unwrap(); - match *IS_ATTY { - true => { - match color { - Some(c) => t.fg(c).unwrap(), - None => (), - } - if is_bold { - t.attr(term::Attr::Bold).unwrap(); - } - write!(t, "{}", m).unwrap(); - t.reset().unwrap(); - }, - false => write!(t, "{}", m).unwrap(), - }; + if *IS_ATTY { + if let Some(c) = color { + t.fg(c).unwrap(); + } + if is_bold { + t.attr(term::Attr::Bold).unwrap(); + } + write!(t, "{}", m).unwrap(); + t.reset().unwrap(); + } else { + write!(t, "{}", m).unwrap(); + } } pub fn print_color_and_flush(color: Option, is_bold: bool, m: &str) { diff --git a/src/util_os.rs b/src/util_os.rs index 03959d9..78544c9 100644 --- a/src/util_os.rs +++ b/src/util_os.rs @@ -1,18 +1,10 @@ pub fn is_macos() -> bool { - if cfg!(target_os = "macos") { - true - } else { - false - } + cfg!(target_os = "macos") } pub fn is_linux() -> bool { - if cfg!(target_os = "linux") { - true - } else { - false - } + cfg!(target_os = "linux") } pub fn is_macos_or_linux() -> bool {