From 62f6b476284da67efc55483a81b57f99a478702a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 14 Jul 2026 01:49:39 +0800 Subject: feat(picker): add `is_empty` method and refactor `if let` chains Refactor multiple `if let` patterns in macros to use the let-chain syntax for improved readability --- mingling_picker/src/picker.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mingling_picker/src') diff --git a/mingling_picker/src/picker.rs b/mingling_picker/src/picker.rs index f8d3cb1..01bebc7 100644 --- a/mingling_picker/src/picker.rs +++ b/mingling_picker/src/picker.rs @@ -81,6 +81,23 @@ impl<'a> Picker<'a> { } } + /// Returns `true` if the picker contains no arguments. + /// + /// # Examples + /// + /// ``` + /// use mingling_picker::Picker; + /// + /// let empty: Picker = Picker::from(&[][..]); + /// assert!(empty.is_empty()); + /// + /// let args = Picker::from(&["hello"][..]); + /// assert!(!args.is_empty()); + /// ``` + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Returns an iterator over the arguments, yielding owned `String` values. /// /// # Examples -- cgit