This doesn't need to be a closure

This commit is contained in:
greg 2018-05-12 20:51:30 -07:00
parent ac576be604
commit 24b532df06

View File

@ -694,12 +694,12 @@ impl Parser {
parse_method!(if_expr(&mut self) -> ParseResult<Expression> {
expect!(self, Keyword(Kw::If), "'if'");
let condition = (|| {
let condition = {
self.restrictions.no_struct_literal = true;
let x = self.expression();
self.restrictions.no_struct_literal = false;
x
})()?;
x?
};
let then_clause = self.block()?;
let else_clause = self.else_clause()?;
Ok(Expression(ExpressionType::IfExpression(bx!(condition), then_clause, else_clause), None))