1
Fork 0

Fix empty body format, add fn_empty_single_line option, refactor block tests

This commit is contained in:
Kevin Yeh 2015-11-19 20:11:32 -06:00
parent fbd1398c92
commit 15ec5b2912
16 changed files with 50 additions and 62 deletions

View file

@ -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);
}