mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
Avoid regression
This commit is contained in:
+4
-4
@@ -2281,10 +2281,10 @@ fn rewrite_last_closure(
|
||||
let body_shape = try_opt!(shape.offset_left(extra_offset));
|
||||
// When overflowing the closure which consists of a single control flow expression,
|
||||
// force to use block if its condition uses multi line.
|
||||
if rewrite_cond(context, body, body_shape)
|
||||
.map(|cond| cond.contains('\n'))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
let is_multi_lined_cond = rewrite_cond(context, body, body_shape)
|
||||
.map(|cond| cond.contains('\n') || cond.len() > body_shape.width)
|
||||
.unwrap_or(false);
|
||||
if is_multi_lined_cond {
|
||||
return rewrite_closure_with_block(context, body_shape, &prefix, body);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user