diff --git a/src/expr.rs b/src/expr.rs index c9d704765c2..52b33ea1a26 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1984,6 +1984,9 @@ pub(crate) fn rewrite_assign_rhs_with, R: Rewrite>( ) -> Option { let lhs = lhs.into(); let rhs = rewrite_assign_rhs_expr(context, &lhs, ex, shape, rhs_kind, rhs_tactics)?; + if context.config.version() == Version::Two && lhs.ends_with(" ") && rhs.starts_with(" ") { + return Some(lhs + &rhs.trim_start()); + } Some(lhs + &rhs) } diff --git a/tests/target/issue-5525.rs b/tests/target/issue-5525.rs new file mode 100644 index 00000000000..e339b7e0526 --- /dev/null +++ b/tests/target/issue-5525.rs @@ -0,0 +1,9 @@ +// rustfmt-version: Two + +pub struct SomeCallback( + pub extern "C" fn( + long_argument_name_to_avoid_wrap: u32, + second_long_argument_name: u32, + third_long_argument_name: u32, + ), +);