fix: clippy

This commit is contained in:
blindfs 2025-04-22 11:23:43 +08:00
parent 27c3fd670c
commit 5655bb62ab

View File

@ -4062,30 +4062,49 @@ pub fn parse_signature_helper(working_set: &mut StateWorkingSet, span: Span) ->
//TODO check if we're replacing a custom parameter already //TODO check if we're replacing a custom parameter already
match last { match last {
Arg::Positional { Arg::Positional {
arg: PositionalArg { shape, var_id, custom_completion, .. }, arg:
PositionalArg {
shape,
var_id,
custom_completion,
..
},
required: _, required: _,
type_annotated, type_annotated,
} => { } => {
working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), syntax_shape.to_type()); working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), syntax_shape.to_type());
// Extract custom_completion from CompleterWrapper if present // Extract custom_completion from CompleterWrapper if present
if let SyntaxShape::CompleterWrapper(_, decl_id) = &syntax_shape { if let SyntaxShape::CompleterWrapper(_, decl_id) =
&syntax_shape
{
*custom_completion = Some(*decl_id); *custom_completion = Some(*decl_id);
} }
*shape = syntax_shape; *shape = syntax_shape;
*type_annotated = true; *type_annotated = true;
} }
Arg::RestPositional(PositionalArg { Arg::RestPositional(PositionalArg {
shape, var_id, custom_completion, .. shape,
var_id,
custom_completion,
..
}) => { }) => {
working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), Type::List(Box::new(syntax_shape.to_type()))); working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), Type::List(Box::new(syntax_shape.to_type())));
// Extract custom_completion from CompleterWrapper if present // Extract custom_completion from CompleterWrapper if present
if let SyntaxShape::CompleterWrapper(_, decl_id) = &syntax_shape { if let SyntaxShape::CompleterWrapper(_, decl_id) =
&syntax_shape
{
*custom_completion = Some(*decl_id); *custom_completion = Some(*decl_id);
} }
*shape = syntax_shape; *shape = syntax_shape;
} }
Arg::Flag { Arg::Flag {
flag: Flag { arg, var_id, custom_completion, .. }, flag:
Flag {
arg,
var_id,
custom_completion,
..
},
type_annotated, type_annotated,
} => { } => {
working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), syntax_shape.to_type()); working_set.set_variable_type(var_id.expect("internal error: all custom parameters must have var_ids"), syntax_shape.to_type());
@ -4097,7 +4116,9 @@ pub fn parse_signature_helper(working_set: &mut StateWorkingSet, span: Span) ->
)); ));
} }
// Extract custom_completion from CompleterWrapper if present // Extract custom_completion from CompleterWrapper if present
if let SyntaxShape::CompleterWrapper(_, decl_id) = &syntax_shape { if let SyntaxShape::CompleterWrapper(_, decl_id) =
&syntax_shape
{
*custom_completion = Some(*decl_id); *custom_completion = Some(*decl_id);
} }
*arg = Some(syntax_shape); *arg = Some(syntax_shape);
@ -5058,8 +5079,7 @@ pub fn parse_value(
match shape { match shape {
SyntaxShape::CompleterWrapper(shape, _custom_completion) => { SyntaxShape::CompleterWrapper(shape, _custom_completion) => {
// Ignore the custom_completion field since it's now stored in PositionalArg/Flag // Ignore the custom_completion field since it's now stored in PositionalArg/Flag
let expression = parse_value(working_set, span, shape); parse_value(working_set, span, shape)
expression
} }
SyntaxShape::Number => parse_number(working_set, span), SyntaxShape::Number => parse_number(working_set, span),
SyntaxShape::Float => parse_float(working_set, span), SyntaxShape::Float => parse_float(working_set, span),