Skip to content

Commit ee93de8

Browse files
committed
use zip for cleaner iteration with 1-based index
1 parent e7f2fd9 commit ee93de8

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/uu/dircolors/src/dircolors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ where
364364
let mut state = ParseState::Global;
365365
let mut saw_colorterm_match = false;
366366

367-
for (num, line) in user_input.into_iter().enumerate() {
368-
let num = num + 1;
367+
for (num, line) in (1..).zip(user_input.into_iter()) {
369368
let line = line.borrow().purify();
370369
if line.is_empty() {
371370
continue;

src/uu/sort/src/sort.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,8 +1799,7 @@ fn emit_debug_warnings(
17991799

18001800
show_error!("{}", translate!("sort-warning-simple-byte-comparison"));
18011801

1802-
for (idx, selector) in settings.selectors.iter().enumerate() {
1803-
let key_index = idx + 1;
1802+
for (key_index, selector) in (1..).zip(settings.selectors.iter()) {
18041803
if let Some(legacy) = legacy_warnings
18051804
.iter()
18061805
.find(|warning| warning.key_index == Some(key_index))

0 commit comments

Comments
 (0)