wrap else
to next line if let-else
pattern is multi-lined
This rule wasn't explicity stated in the style guide so it was missed, but luckily we caught it during testing.
This commit is contained in:
parent
7b4e8a6d31
commit
1de65a2711
@ -127,8 +127,8 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
|
||||
|
||||
if let Some(block) = else_block {
|
||||
let else_kw_span = init.span.between(block.span);
|
||||
let force_newline_else =
|
||||
!same_line_else_kw_and_brace(&result, context, else_kw_span, nested_shape);
|
||||
let force_newline_else = pat_str.contains('\n')
|
||||
|| !same_line_else_kw_and_brace(&result, context, else_kw_span, nested_shape);
|
||||
let else_kw = rewrite_else_kw_with_comments(
|
||||
force_newline_else,
|
||||
true,
|
||||
|
@ -24,7 +24,8 @@ fn main() {
|
||||
upper,
|
||||
step,
|
||||
range: _,
|
||||
}) = slice.as_ref() else {
|
||||
}) = slice.as_ref()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,8 @@ fn main() {
|
||||
upper,
|
||||
step,
|
||||
range: _,
|
||||
}) = slice.as_ref() else {
|
||||
}) = slice.as_ref()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,8 @@ fn main() {
|
||||
upper,
|
||||
step,
|
||||
range: _,
|
||||
}) = slice.as_ref() else {
|
||||
}) = slice.as_ref()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user