self.last_pos = item.span.lo() + BytePos(brace_pos as u32 + 1);
self.block_indent = self.block_indent.block_indent(self.config);
- if item.body.is_empty() {
- self.format_missing_no_indent(item.span.hi() - BytePos(1));
- self.block_indent = self.block_indent.block_unindent(self.config);
- let indent_str = self.block_indent.to_string(self.config);
- self.push_str(&indent_str);
- } else {
+ if !item.body.is_empty() {
for item in &item.body {
self.format_body_element(item);
}
-
- self.block_indent = self.block_indent.block_unindent(self.config);
- self.format_missing_with_indent(item.span.hi() - BytePos(1));
}
+
+ self.format_missing_no_indent(item.span.hi() - BytePos(1));
+ self.block_indent = self.block_indent.block_unindent(self.config);
+ let indent_str = self.block_indent.to_string(self.config);
+ self.push_str(&indent_str);
}
self.push_str("}");
result.push_str(&where_clause_str);
force_new_line_for_brace |= last_line_contains_single_line_comment(&result);
- force_new_line_for_brace |= is_params_multi_lined && context.config.where_single_line();
+ force_new_line_for_brace |=
+ is_params_multi_lined && context.config.where_single_line() && !where_clause_str.is_empty();
Some((result, force_new_line_for_brace))
}