Inline make_if macro
This commit is contained in:
parent
8746b79a38
commit
02cd72e34b
@ -442,18 +442,10 @@ fn lower_expr_if(
|
||||
then: &Block,
|
||||
else_opt: Option<&Expr>,
|
||||
) -> hir::ExprKind<'hir> {
|
||||
macro_rules! make_if {
|
||||
($opt:expr) => {{
|
||||
let cond = self.lower_expr(cond);
|
||||
let then_expr = self.lower_block_expr(then);
|
||||
hir::ExprKind::If(cond, self.arena.alloc(then_expr), $opt)
|
||||
}};
|
||||
}
|
||||
if let Some(rslt) = else_opt {
|
||||
make_if!(Some(self.lower_expr(rslt)))
|
||||
} else {
|
||||
make_if!(None)
|
||||
}
|
||||
let cond = self.lower_expr(cond);
|
||||
let then = self.arena.alloc(self.lower_block_expr(then));
|
||||
let els = else_opt.map(|els| self.lower_expr(els));
|
||||
hir::ExprKind::If(cond, then, els)
|
||||
}
|
||||
|
||||
fn lower_expr_if_let(
|
||||
|
Loading…
Reference in New Issue
Block a user