Skip to content

Commit 2d1fc91

Browse files
committed
refactor(sort): simplify detect_numeric_locale with struct literal
Use struct literal initialization instead of creating a mutable default and assigning fields, improving code conciseness and readability without changing functionality.
1 parent 9dc0648 commit 2d1fc91

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/uu/sort/src/sort.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,13 +1322,13 @@ impl FieldSelector {
13221322
}
13231323

13241324
fn detect_numeric_locale() -> NumericLocaleSettings {
1325-
let mut settings = NumericLocaleSettings::default();
1326-
settings.decimal_pt = Some(locale_decimal_pt());
1327-
settings.thousands_sep = match i18n::decimal::locale_grouping_separator().as_bytes() {
1328-
[b] => Some(*b),
1329-
_ => None,
1330-
};
1331-
settings
1325+
NumericLocaleSettings {
1326+
decimal_pt: Some(locale_decimal_pt()),
1327+
thousands_sep: match i18n::decimal::locale_grouping_separator().as_bytes() {
1328+
[b] => Some(*b),
1329+
_ => None,
1330+
},
1331+
}
13321332
}
13331333
/// Creates an `Arg` for a sort mode flag.
13341334
fn make_sort_mode_arg(mode: &'static str, short: char, help: String) -> Arg {

0 commit comments

Comments
 (0)