From c7ad6ff483cc9ea16c020dacdb00530fe7dee6b3 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 5 Feb 2026 05:35:07 +0900 Subject: [PATCH] sort: remove redundant if (#10716) --- src/uu/sort/src/sort.rs | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 10bd76718..89d4520d3 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -2046,25 +2046,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .unwrap_or_default() }; - let mut mode_flags = ModeFlags::default(); - if matches.get_flag(options::modes::HUMAN_NUMERIC) { - mode_flags.human_numeric = true; - } - if matches.get_flag(options::modes::MONTH) { - mode_flags.month = true; - } - if matches.get_flag(options::modes::GENERAL_NUMERIC) { - mode_flags.general_numeric = true; - } - if matches.get_flag(options::modes::NUMERIC) { - mode_flags.numeric = true; - } - if matches.get_flag(options::modes::VERSION) { - mode_flags.version = true; - } - if matches.get_flag(options::modes::RANDOM) { - mode_flags.random = true; - } + let mut mode_flags = ModeFlags { + human_numeric: matches.get_flag(options::modes::HUMAN_NUMERIC), + month: matches.get_flag(options::modes::MONTH), + general_numeric: matches.get_flag(options::modes::GENERAL_NUMERIC), + numeric: matches.get_flag(options::modes::NUMERIC), + version: matches.get_flag(options::modes::VERSION), + random: matches.get_flag(options::modes::RANDOM), + }; if let Some(sort_arg) = matches.get_one::(options::modes::SORT) { match sort_arg.as_str() { "human-numeric" => mode_flags.human_numeric = true,