aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/parser/picker.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-10 14:57:16 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-10 14:57:16 +0800
commit782d2458dc4ad4336e1407e1f107e43e39b0b991 (patch)
tree2619912357c03cae32190388e9436e15431c298c /mingling/src/parser/picker.rs
parent6b18873666e17ab68ffce799b1707c030166738f (diff)
chore: enforce pedantic clippy lints and fix warnings
Diffstat (limited to 'mingling/src/parser/picker.rs')
-rw-r--r--mingling/src/parser/picker.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/mingling/src/parser/picker.rs b/mingling/src/parser/picker.rs
index ca4561c..f199f5d 100644
--- a/mingling/src/parser/picker.rs
+++ b/mingling/src/parser/picker.rs
@@ -22,8 +22,8 @@ pub struct Picker {
impl Picker {
/// Creates a new `Picker` from a value that can be converted into `Argument`.
- pub fn new(args: impl Into<Argument>) -> Picker {
- Picker { args: args.into() }
+ pub fn new(args: impl Into<Argument>) -> Self {
+ Self { args: args.into() }
}
/// Extracts a value for the given flag and returns a `Pick1` builder (no route).
@@ -50,7 +50,7 @@ impl Picker {
where
TNext: Pickable<Output = TNext>,
{
- let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into());
+ let v = TNext::pick(&mut self.args, val.into()).unwrap_or_else(|| or.into());
Pick1 {
args: self.args,
val_1: v,
@@ -118,7 +118,7 @@ impl Picker {
impl<T: Into<Argument>> From<T> for Picker {
fn from(value: T) -> Self {
- Picker::new(value)
+ Self::new(value)
}
}
@@ -342,7 +342,7 @@ macro_rules! impl_pick_next {
where
TNext: Pickable<Output = TNext>,
{
- let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into());
+ let v = TNext::pick(&mut self.args, val.into()).unwrap_or_else(|| or.into());
$next {
args: self.args,
$($val: self.$val,)+
@@ -647,7 +647,7 @@ macro_rules! impl_pick_with_route_next {
where
TNext: Pickable<Output = TNext>,
{
- let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into());
+ let v = TNext::pick(&mut self.args, val.into()).unwrap_or_else(|| or.into());
$next {
args: self.args,
$($val: self.$val,)+