diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-15 22:21:56 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-15 22:21:56 +0800 |
| commit | 6d61e0c46d33b917438386191e1e11351359abac (patch) | |
| tree | 93a402007a4ac1a4b561a454ab758480d7213c0d /mingling | |
| parent | a2eefa6abb7b7b86ab78466bf5abc4877d255d79 (diff) | |
Inline `strip_all_flags` and simplify `ShellContext` methods
Simplify `strip_all_flags` by using `Vec::retain` instead of
reallocating. Update doc examples to use `ShellContext` methods directly
instead of the now-removed `ShellContextHelper`. Rename `as_picker` to
`to_picker` for consistency with Rust conventions. Mark doc tests as
`ignore` and add necessary imports.
Diffstat (limited to 'mingling')
| -rw-r--r-- | mingling/src/parser/args.rs | 6 | ||||
| -rw-r--r-- | mingling/src/parser/picker.rs | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/mingling/src/parser/args.rs b/mingling/src/parser/args.rs index 4e8ee1b..2dc0feb 100644 --- a/mingling/src/parser/args.rs +++ b/mingling/src/parser/args.rs @@ -168,11 +168,7 @@ impl Argument { /// This method filters out all command-line style flags from the arguments, /// returning a new `Argument` instance containing only non-flag arguments. pub fn strip_all_flags(mut self) -> Self { - self.vec = self - .vec - .into_iter() - .filter(|f| !f.starts_with('-')) - .collect(); + self.vec.retain(|f| !f.starts_with('-')); self } } diff --git a/mingling/src/parser/picker.rs b/mingling/src/parser/picker.rs index 915bc35..91c7c83 100644 --- a/mingling/src/parser/picker.rs +++ b/mingling/src/parser/picker.rs @@ -725,7 +725,7 @@ where Self: Into<Vec<String>>, { /// Converts the value into a `Picker` by first converting it into a `Vec<String>`. - fn as_picker(self) -> Picker + fn to_picker(self) -> Picker where Self: Sized, Vec<String>: From<Self>, |
