From c5217b3136808a078225f94cd0d686b2a41a2dcb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 24 Dec 2023 15:03:34 +0100 Subject: [PATCH] ls: remove unused arg check_for_deref --- src/uu/ls/src/ls.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 70d05d95e..163fc78e1 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -3070,7 +3070,7 @@ fn display_item_name( } if let Some(ls_colors) = &config.color { - name = color_name(name, path, ls_colors, style_manager, out, false, None); + name = color_name(name, path, ls_colors, style_manager, out, None); } if config.format != Format::Long && !more_info.is_empty() { @@ -3151,7 +3151,6 @@ fn display_item_name( ls_colors, style_manager, out, - true, Some(&target_data), )); } @@ -3272,7 +3271,6 @@ fn color_name( ls_colors: &LsColors, style_manager: &mut StyleManager, out: &mut BufWriter, - check_for_deref: bool, target_symlink: Option<&PathData>, ) -> String { if !path.must_dereference { @@ -3286,11 +3284,10 @@ fn color_name( } } - if check_for_deref { + if let Some(target) = target_symlink { // use the optional target_symlink // Use fn get_metadata_with_deref_opt instead of get_metadata() here because ls // should not exit with an err, if we are unable to obtain the target_metadata - let target = target_symlink.unwrap_or(path); let md = get_metadata_with_deref_opt(target.p_buf.as_path(), path.must_dereference) .unwrap_or_else(|_| target.get_metadata(out).unwrap().clone());