From b5161137228c1eaf7c0ca3194a01a317f1c32fe5 Mon Sep 17 00:00:00 2001 From: auronandace Date: Thu, 19 Mar 2026 13:03:16 +0000 Subject: [PATCH] minor cleanup --- src/header/monetary/mod.rs | 6 ++---- src/header/stdlib/mod.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/header/monetary/mod.rs b/src/header/monetary/mod.rs index c809fd2033..973b1830a3 100644 --- a/src/header/monetary/mod.rs +++ b/src/header/monetary/mod.rs @@ -66,15 +66,14 @@ struct FormatFlags { /// Formats a monetary value according to the current locale. fn apply_grouping(int_str: &str, monetary: &LocaleMonetaryInfo) -> String { let mut grouped = String::with_capacity(int_str.len() * 2); - let mut count = 0; let mut group_idx = 0; let current_grouping = &monetary.mon_grouping; let separator = monetary.mon_thousands_sep; - for c in int_str.chars() { + for (count, c) in int_str.chars().enumerate() { if count > 0 { let current_group = current_grouping[group_idx.min(current_grouping.len() - 1)]; - if current_group > 0 && count % current_group == 0 { + if current_group > 0 && (count as u8).is_multiple_of(current_group) { grouped.push_str(separator); if group_idx + 1 < current_grouping.len() { group_idx += 1; @@ -82,7 +81,6 @@ fn apply_grouping(int_str: &str, monetary: &LocaleMonetaryInfo) -> String { } } grouped.push(c); - count += 1; } grouped diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs index 5fb1b4d04a..6e06356b92 100644 --- a/src/header/stdlib/mod.rs +++ b/src/header/stdlib/mod.rs @@ -1425,7 +1425,7 @@ pub unsafe fn convert_hex(s: *const c_char) -> Option<(c_ulong, isize, bool)> { unsafe { convert_integer(s.offset(2), 16) } .map(|(val, idx, overflow)| (val, idx + 2, overflow)) } else { - unsafe { convert_integer(s, 16) }.map(|(val, idx, overflow)| (val, idx, overflow)) + unsafe { convert_integer(s, 16) } } }