Skip to content

Commit c7ad6ff

Browse files
authored
sort: remove redundant if (#10716)
1 parent 682d9c5 commit c7ad6ff

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

src/uu/sort/src/sort.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,25 +2046,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
20462046
.unwrap_or_default()
20472047
};
20482048

2049-
let mut mode_flags = ModeFlags::default();
2050-
if matches.get_flag(options::modes::HUMAN_NUMERIC) {
2051-
mode_flags.human_numeric = true;
2052-
}
2053-
if matches.get_flag(options::modes::MONTH) {
2054-
mode_flags.month = true;
2055-
}
2056-
if matches.get_flag(options::modes::GENERAL_NUMERIC) {
2057-
mode_flags.general_numeric = true;
2058-
}
2059-
if matches.get_flag(options::modes::NUMERIC) {
2060-
mode_flags.numeric = true;
2061-
}
2062-
if matches.get_flag(options::modes::VERSION) {
2063-
mode_flags.version = true;
2064-
}
2065-
if matches.get_flag(options::modes::RANDOM) {
2066-
mode_flags.random = true;
2067-
}
2049+
let mut mode_flags = ModeFlags {
2050+
human_numeric: matches.get_flag(options::modes::HUMAN_NUMERIC),
2051+
month: matches.get_flag(options::modes::MONTH),
2052+
general_numeric: matches.get_flag(options::modes::GENERAL_NUMERIC),
2053+
numeric: matches.get_flag(options::modes::NUMERIC),
2054+
version: matches.get_flag(options::modes::VERSION),
2055+
random: matches.get_flag(options::modes::RANDOM),
2056+
};
20682057
if let Some(sort_arg) = matches.get_one::<String>(options::modes::SORT) {
20692058
match sort_arg.as_str() {
20702059
"human-numeric" => mode_flags.human_numeric = true,

0 commit comments

Comments
 (0)