mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
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.
This commit is contained in:
@@ -1322,13 +1322,13 @@ impl FieldSelector {
|
||||
}
|
||||
|
||||
fn detect_numeric_locale() -> NumericLocaleSettings {
|
||||
let mut settings = NumericLocaleSettings::default();
|
||||
settings.decimal_pt = Some(locale_decimal_pt());
|
||||
settings.thousands_sep = match i18n::decimal::locale_grouping_separator().as_bytes() {
|
||||
[b] => Some(*b),
|
||||
_ => None,
|
||||
};
|
||||
settings
|
||||
NumericLocaleSettings {
|
||||
decimal_pt: Some(locale_decimal_pt()),
|
||||
thousands_sep: match i18n::decimal::locale_grouping_separator().as_bytes() {
|
||||
[b] => Some(*b),
|
||||
_ => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
/// Creates an `Arg` for a sort mode flag.
|
||||
fn make_sort_mode_arg(mode: &'static str, short: char, help: String) -> Arg {
|
||||
|
||||
Reference in New Issue
Block a user