From 3233b0e73eb76a53101294563cc1b7b2657f8423 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 1 Feb 2026 22:40:21 +0100 Subject: [PATCH 1/2] sort: use zip for cleaner iteration with 1-based index --- src/uu/sort/src/sort.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ba5d34a5660..05233a01d50 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1799,8 +1799,7 @@ fn emit_debug_warnings( show_error!("{}", translate!("sort-warning-simple-byte-comparison")); - for (idx, selector) in settings.selectors.iter().enumerate() { - let key_index = idx + 1; + for (key_index, selector) in (1..).zip(settings.selectors.iter()) { if let Some(legacy) = legacy_warnings .iter() .find(|warning| warning.key_index == Some(key_index)) From 16c920c81e7340d64819db3ef8a1d379c37dbb64 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 16 Feb 2026 09:33:51 +0000 Subject: [PATCH 2/2] dircolors: use zip for cleaner iteration with 1-based index --- src/uu/dircolors/src/dircolors.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 815c3422e42..5454648d796 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -364,8 +364,7 @@ where let mut state = ParseState::Global; let mut saw_colorterm_match = false; - for (num, line) in user_input.into_iter().enumerate() { - let num = num + 1; + for (num, line) in (1..).zip(user_input.into_iter()) { let line = line.borrow().purify(); if line.is_empty() { continue;