Skip to content

Commit 3034266

Browse files
committed
ls: simplify extraction of indices
1 parent 4704cae commit 3034266

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/uu/ls/src/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ fn extract_sort(options: &clap::ArgMatches) -> Sort {
311311
};
312312

313313
let sort_index = options
314-
.get_one::<String>(options::SORT)
315-
.and_then(|_| options.indices_of(options::SORT))
316-
.map_or(0, |mut indices| indices.next_back().unwrap_or(0));
314+
.indices_of(options::SORT)
315+
.and_then(|mut it| it.next_back())
316+
.unwrap_or(0);
317317
let time_index = get_last_index(options::sort::TIME);
318318
let size_index = get_last_index(options::sort::SIZE);
319319
let none_index = get_last_index(options::sort::NONE);
@@ -427,9 +427,9 @@ fn extract_color(options: &clap::ArgMatches) -> bool {
427427
};
428428

429429
let color_index = options
430-
.get_one::<String>(options::COLOR)
431-
.and_then(|_| options.indices_of(options::COLOR))
432-
.map_or(0, |mut indices| indices.next_back().unwrap_or(0));
430+
.indices_of(options::COLOR)
431+
.and_then(|mut it| it.next_back())
432+
.unwrap_or(0);
433433
let unsorted_all_index = get_last_index(options::files::UNSORTED_ALL);
434434

435435
let color_enabled = match options.get_one::<String>(options::COLOR) {

0 commit comments

Comments
 (0)