Skip to content

Commit cfbcf7e

Browse files
committed
refactor: simplify separator trimming in locale test
Use array slice for trim_end_matches and String::len for length check to improve readability and efficiency in test_human_numeric_blank_thousands_sep_locale.
1 parent c64a3f3 commit cfbcf7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/by-util/test_sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,8 +1672,8 @@ fn test_human_numeric_blank_thousands_sep_locale() {
16721672
return None;
16731673
}
16741674
let sep = String::from_utf8_lossy(&output.stdout);
1675-
let sep = sep.trim_end_matches(|ch| ch == '\n' || ch == '\r');
1676-
if sep.is_empty() || sep.as_bytes().len() != 1 || !sep.chars().all(|c| c.is_whitespace()) {
1675+
let sep = sep.trim_end_matches(&['\n', '\r'][..]);
1676+
if sep.is_empty() || sep.len() != 1 || !sep.chars().all(|c| c.is_whitespace()) {
16771677
return None;
16781678
}
16791679
Some(sep.to_string())

0 commit comments

Comments
 (0)