diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index 12abaf1996..c45bb251e6 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -2516,33 +2516,10 @@ impl Parameters { } } -#[allow(clippy::borrowed_box)] // local utility -fn clone_boxed_expr(expr: &Box) -> Box { - let expr: &Expr = expr.as_ref(); - Box::new(expr.clone()) -} - impl ParameterWithDefault { pub fn as_parameter(&self) -> &Parameter { &self.parameter } - - pub fn to_parameter(&self) -> (Parameter, Option>) { - let ParameterWithDefault { - range: _, - parameter, - default, - } = self; - (parameter.clone(), default.as_ref().map(clone_boxed_expr)) - } - pub fn into_parameter(self) -> (Parameter, Option>) { - let ParameterWithDefault { - range: _, - parameter, - default, - } = self; - (parameter, default) - } } impl Parameters { diff --git a/crates/ruff_python_formatter/src/other/parameter_with_default.rs b/crates/ruff_python_formatter/src/other/parameter_with_default.rs index a434c7586f..74164fb5d9 100644 --- a/crates/ruff_python_formatter/src/other/parameter_with_default.rs +++ b/crates/ruff_python_formatter/src/other/parameter_with_default.rs @@ -62,7 +62,7 @@ impl FormatNodeRule for FormatParameterWithDefault { token("="), (!needs_line_break).then_some(space), needs_line_break.then_some(hard_line_break()), - group(&default.format()) + default.format() ] )?; }