From 10bf8bdfe09e3ab80edcd45b9018b1412ef14f64 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Apr 2026 20:18:46 +0800 Subject: Replace length checks with `is_empty` and `?` operator --- mingling/src/parser/picker/builtin.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'mingling/src/parser/picker') diff --git a/mingling/src/parser/picker/builtin.rs b/mingling/src/parser/picker/builtin.rs index 8a10dfc..9fbbfd1 100644 --- a/mingling/src/parser/picker/builtin.rs +++ b/mingling/src/parser/picker/builtin.rs @@ -25,9 +25,7 @@ macro_rules! impl_pickable_for_number { type Output = $t; fn pick(args: &mut crate::parser::Argument, flag: mingling_core::Flag) -> Option { - let Some(picked) = args.pick_argument(flag) else { - return None; - }; + let picked = args.pick_argument(flag)?; picked.parse().ok() } } @@ -66,9 +64,7 @@ impl Pickable for usize { type Output = usize; fn pick(args: &mut crate::parser::Argument, flag: mingling_core::Flag) -> Option { - let Some(picked) = args.pick_argument(flag) else { - return None; - }; + let picked = args.pick_argument(flag)?; let size_parse = Size::from_str(picked.as_str()); match size_parse { Ok(size) => Some(size.bytes() as usize), -- cgit