Skip to content

Commit

Permalink
fix: AllParams single param multiline condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Oct 24, 2024
1 parent d6e6570 commit fa74ac8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1638,13 +1638,17 @@ impl<'a, W: Write> Formatter<'a, W> {
&params,
",",
)?;
// Write new line if we have only one parameter and params first all multi set.
// Write new line if we have only one parameter and params first set,
// or if the function definition is multiline and all params set.
if params.len() == 1 &&
matches!(
(matches!(
fmt.config.multiline_func_header,
MultilineFuncHeaderStyle::ParamsFirst |
MultilineFuncHeaderStyle::ParamsFirst
) || params_multiline &&
matches!(
fmt.config.multiline_func_header,
MultilineFuncHeaderStyle::AllParams
)
))
{
writeln!(fmt.buf())?;
}
Expand Down

0 comments on commit fa74ac8

Please sign in to comment.