Collapse if-else
This commit is contained in:
parent
b023cc831c
commit
4e1a75a429
@ -327,12 +327,10 @@ fn rewrite_comment_inner(
|
||||
if line.is_empty() {
|
||||
continue;
|
||||
}
|
||||
} else if is_prev_line_multi_line && !line.is_empty() {
|
||||
result.push(' ')
|
||||
} else {
|
||||
if is_prev_line_multi_line && !line.is_empty() {
|
||||
result.push(' ')
|
||||
} else {
|
||||
result.push_str(&comment_line_separator);
|
||||
}
|
||||
result.push_str(&comment_line_separator);
|
||||
}
|
||||
|
||||
if config.wrap_comments() && line.len() > fmt.shape.width && !has_url(line) {
|
||||
|
@ -313,10 +313,10 @@ pub fn rewrite_fn(
|
||||
let (mut result, force_newline_brace) =
|
||||
rewrite_fn_base(&context, indent, ident, fn_sig, span, newline_brace, true)?;
|
||||
|
||||
if self.config.fn_brace_style() == BraceStyle::AlwaysNextLine || force_newline_brace {
|
||||
newline_brace = true;
|
||||
} else if last_line_width(&result) + 2 > self.shape().width {
|
||||
// 2 = ` {`
|
||||
// 2 = ` {`
|
||||
if self.config.fn_brace_style() == BraceStyle::AlwaysNextLine || force_newline_brace
|
||||
|| last_line_width(&result) + 2 > self.shape().width
|
||||
{
|
||||
newline_brace = true;
|
||||
} else if !result.contains('\n') {
|
||||
newline_brace = false;
|
||||
|
Loading…
Reference in New Issue
Block a user