From c8813c8331aa8fbbeb393f10ed8ce826920f9893 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:24:32 +0100 Subject: [PATCH] ls: simplify extraction of indices --- src/uu/ls/src/config.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/ls/src/config.rs b/src/uu/ls/src/config.rs index 2cc87c788..383d36451 100644 --- a/src/uu/ls/src/config.rs +++ b/src/uu/ls/src/config.rs @@ -311,9 +311,9 @@ fn extract_sort(options: &clap::ArgMatches) -> Sort { }; let sort_index = options - .get_one::(options::SORT) - .and_then(|_| options.indices_of(options::SORT)) - .map_or(0, |mut indices| indices.next_back().unwrap_or(0)); + .indices_of(options::SORT) + .and_then(|mut it| it.next_back()) + .unwrap_or(0); let time_index = get_last_index(options::sort::TIME); let size_index = get_last_index(options::sort::SIZE); let none_index = get_last_index(options::sort::NONE); @@ -427,9 +427,9 @@ fn extract_color(options: &clap::ArgMatches) -> bool { }; let color_index = options - .get_one::(options::COLOR) - .and_then(|_| options.indices_of(options::COLOR)) - .map_or(0, |mut indices| indices.next_back().unwrap_or(0)); + .indices_of(options::COLOR) + .and_then(|mut it| it.next_back()) + .unwrap_or(0); let unsorted_all_index = get_last_index(options::files::UNSORTED_ALL); let color_enabled = match options.get_one::(options::COLOR) {