diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-06 20:18:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-06 20:18:46 +0800 |
| commit | 10bf8bdfe09e3ab80edcd45b9018b1412ef14f64 (patch) | |
| tree | 985217a8a489fc2873b589df9e90aa7f750260ac /mingling/src/parser/picker/builtin.rs | |
| parent | bd9d4006b6e97f26dfb732899a4c4d839558917c (diff) | |
Replace length checks with `is_empty` and `?` operator
Diffstat (limited to 'mingling/src/parser/picker/builtin.rs')
| -rw-r--r-- | mingling/src/parser/picker/builtin.rs | 8 |
1 files changed, 2 insertions, 6 deletions
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<Self::Output> { - 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<Self::Output> { - 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), |
