Fix empty body format, add fn_empty_single_line option, refactor block tests
This commit is contained in:
parent
fbd1398c92
commit
15ec5b2912
16 changed files with 50 additions and 62 deletions
|
@ -154,16 +154,15 @@ impl<'a> FmtVisitor<'a> {
|
|||
visit::FnKind::Closure => None,
|
||||
};
|
||||
|
||||
if let Some(ref single_line_fn) = self.rewrite_single_line_fn(&rewrite, &b) {
|
||||
self.format_missing_with_indent(s.lo);
|
||||
self.buffer.push_str(single_line_fn);
|
||||
self.last_pos = b.span.hi;
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(fn_str) = rewrite {
|
||||
self.format_missing_with_indent(s.lo);
|
||||
self.buffer.push_str(&fn_str);
|
||||
if let Some(ref single_line_fn) = self.rewrite_single_line_fn(&fn_str, &b) {
|
||||
self.buffer.push_str(single_line_fn);
|
||||
self.last_pos = b.span.hi;
|
||||
return;
|
||||
} else {
|
||||
self.buffer.push_str(&fn_str);
|
||||
}
|
||||
} else {
|
||||
self.format_missing(b.span.lo);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue