From 491ae5956242eccfa4cafd3cc34d66f10c26cd22 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 20 Apr 2026 14:06:45 +0800 Subject: Make `pick_or` accept `Into` for default value --- mingling/src/parser/picker.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mingling/src') diff --git a/mingling/src/parser/picker.rs b/mingling/src/parser/picker.rs index 73c3b8d..449351a 100644 --- a/mingling/src/parser/picker.rs +++ b/mingling/src/parser/picker.rs @@ -50,11 +50,11 @@ impl Picker { /// /// The extracted type `TNext` must implement `Pickable`. /// If the flag is not present, the provided `or` value is used. - pub fn pick_or(mut self, val: impl Into, or: TNext) -> Pick1 + pub fn pick_or(mut self, val: impl Into, or: impl Into) -> Pick1 where TNext: Pickable, { - let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or); + let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into()); Pick1 { args: self.args, val_1: v, @@ -265,11 +265,11 @@ macro_rules! impl_pick_structs { /// /// The extracted type `TNext` must implement `Pickable`. /// If the flag is not present, the provided `or` value is used. - pub fn pick_or(mut self, val: impl Into, or: TNext) -> $next<$($T,)+ TNext, R> + pub fn pick_or(mut self, val: impl Into, or: impl Into) -> $next<$($T,)+ TNext, R> where TNext: Pickable, { - let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or); + let v = TNext::pick(&mut self.args, val.into()).unwrap_or(or.into()); $next { args: self.args, $($val: self.$val,)+ -- cgit