Don't strip semi-colons from expressions with non-void type since it can change semantics

This commit is contained in:
Nick Cameron 2015-11-09 13:23:19 +13:00
parent 1c0934772c
commit 3dc0b804f1
3 changed files with 4 additions and 8 deletions

View file

@ -507,12 +507,8 @@ fn semicolon_for_stmt(stmt: &ast::Stmt) -> bool {
match expr.node {
ast::Expr_::ExprWhile(..) |
ast::Expr_::ExprWhileLet(..) |
ast::Expr_::ExprIf(..) |
ast::Expr_::ExprIfLet(..) |
ast::Expr_::ExprBlock(..) |
ast::Expr_::ExprLoop(..) |
ast::Expr_::ExprForLoop(..) |
ast::Expr_::ExprMatch(..) => false,
ast::Expr_::ExprForLoop(..) => false,
_ => true,
}
}

View file

@ -40,7 +40,7 @@ fn foo() -> bool {
result
} else {
4
}
};
if let Some(x) = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
// Nothing
@ -253,5 +253,5 @@ fn repeats() {
fn blocks() {
if 1 + 1 == 2 {
println!("yay arithmetix!");
}
};
}

View file

@ -228,7 +228,7 @@ fn issue383() {
match resolution.last_private {
LastImport{..} => false,
_ => true,
}
};
}
fn issue507() {