Format source codes and update tests

This commit is contained in:
Seiichi Uchida 2017-07-20 00:01:38 +09:00
parent 0a2567db93
commit b78b6e8b09
4 changed files with 14 additions and 4 deletions

View file

@ -1686,7 +1686,8 @@ fn rewrite_match_body(
) -> Option<String> {
let (extend, body) = match body.node {
ast::ExprKind::Block(ref block)
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) => {
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) =>
{
if let ast::StmtKind::Expr(ref expr) = block.stmts[0].node {
(expr.can_be_overflowed(context, 1), &**expr)
} else {

View file

@ -563,7 +563,10 @@ impl<'a> FmtVisitor<'a> {
if s.rewrite(
&self.get_context(),
Shape::indented(self.block_indent, self.config),
).is_none() => true,
).is_none() =>
{
true
}
None => true,
_ => self.failed,
};

View file

@ -7,7 +7,10 @@ fn main() {
match x
{
aaaaaaaa::Bbbbb::Ccccccccccccc(_, Some(ref x))
if x == "aaaaaaaaaaa aaaaaaa aaaaaa" => Ok(()),
if x == "aaaaaaaaaaa aaaaaaa aaaaaa" =>
{
Ok(())
}
_ => Err(x),
}
}

View file

@ -29,7 +29,10 @@ fn foo() {
}
Patternnnnnnnnnnnnnnnnnnnnnnnnn | Patternnnnnnnnnnnnnnnnnnnnnnnnn
if looooooooooooooooooooooooooooooooooooooooong_guard => meh,
if looooooooooooooooooooooooooooooooooooooooong_guard =>
{
meh
}
// Test that earlier patterns can take the guard space
(aaaa, bbbbb, ccccccc, aaaaa, bbbbbbbb, cccccc, aaaa, bbbbbbbb, cccccc, dddddd) |