Skip to content

Commit e054dcd

Browse files
committed
refactor(sort): simplify byte checks in effective_decimal_pt using contains method
Use input.contains() instead of input.iter().any() for checking presence of comma and dot bytes, improving readability and reducing boilerplate.
1 parent ee75a84 commit e054dcd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/uu/sort/src/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ fn locale_decimal_pt() -> u8 {
124124

125125
fn effective_decimal_pt(input: &[u8], locale_decimal: u8) -> u8 {
126126
if locale_decimal == b',' {
127-
let has_comma = input.iter().any(|&c| c == b',');
128-
if !has_comma && input.iter().any(|&c| c == b'.') {
127+
let has_comma = input.contains(&b',');
128+
if !has_comma && input.contains(&b'.') {
129129
return b'.';
130130
}
131131
}

0 commit comments

Comments
 (0)