Remove newlines in where clauses for v2

Fixes #5655.
This commit is contained in:
Kevin Ji 2023-07-29 22:46:17 -07:00 committed by Yacin Tmimi
parent 4b01e62943
commit a57d57b16a
5 changed files with 38 additions and 1 deletions

View File

@ -2996,10 +2996,12 @@ fn rewrite_bounds_on_where_clause(
DefinitiveListTactic::Vertical
};
let preserve_newline = context.config.version() == Version::One;
let fmt = ListFormatting::new(shape, context.config)
.tactic(shape_tactic)
.trailing_separator(comma_tactic)
.preserve_newline(true);
.preserve_newline(preserve_newline);
write_list(&items.collect::<Vec<_>>(), &fmt)
}

View File

@ -0,0 +1,9 @@
// rustfmt-version: One
fn foo<T>(_: T)
where
T: std::fmt::Debug,
T: std::fmt::Display,
{
}

View File

@ -0,0 +1,9 @@
// rustfmt-version: Two
fn foo<T>(_: T)
where
T: std::fmt::Debug,
T: std::fmt::Display,
{
}

View File

@ -0,0 +1,9 @@
// rustfmt-version: One
fn foo<T>(_: T)
where
T: std::fmt::Debug,
T: std::fmt::Display,
{
}

View File

@ -0,0 +1,8 @@
// rustfmt-version: Two
fn foo<T>(_: T)
where
T: std::fmt::Debug,
T: std::fmt::Display,
{
}