Skip to content

Commit dc1a094

Browse files
authored
Rollup merge of rust-lang#37052 - srinivasreddy:hair_cx, r=pnkfelix
Run rustfmt on librustc_mir/hair/cx
2 parents b4b1e5e + f78aa4d commit dc1a094

File tree

4 files changed

+373
-319
lines changed

4 files changed

+373
-319
lines changed

src/librustc_mir/hair/cx/block.rs

+30-25
Original file line numberDiff line numberDiff line change
@@ -26,47 +26,52 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
2626
extent: cx.tcx.region_maps.node_extent(self.id),
2727
span: self.span,
2828
stmts: stmts,
29-
expr: self.expr.to_ref()
29+
expr: self.expr.to_ref(),
3030
}
3131
}
3232
}
3333

3434
fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
3535
block_id: ast::NodeId,
3636
stmts: &'tcx [hir::Stmt])
37-
-> Vec<StmtRef<'tcx>>
38-
{
37+
-> Vec<StmtRef<'tcx>> {
3938
let mut result = vec![];
4039
for (index, stmt) in stmts.iter().enumerate() {
4140
match stmt.node {
42-
hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) =>
41+
hir::StmtExpr(ref expr, id) |
42+
hir::StmtSemi(ref expr, id) => {
4343
result.push(StmtRef::Mirror(Box::new(Stmt {
4444
span: stmt.span,
4545
kind: StmtKind::Expr {
4646
scope: cx.tcx.region_maps.node_extent(id),
47-
expr: expr.to_ref()
47+
expr: expr.to_ref(),
48+
},
49+
})))
50+
}
51+
hir::StmtDecl(ref decl, id) => {
52+
match decl.node {
53+
hir::DeclItem(..) => {
54+
// ignore for purposes of the MIR
4855
}
49-
}))),
50-
hir::StmtDecl(ref decl, id) => match decl.node {
51-
hir::DeclItem(..) => { /* ignore for purposes of the MIR */ }
52-
hir::DeclLocal(ref local) => {
53-
let remainder_extent = CodeExtentData::Remainder(BlockRemainder {
54-
block: block_id,
55-
first_statement_index: index as u32,
56-
});
57-
let remainder_extent =
58-
cx.tcx.region_maps.lookup_code_extent(remainder_extent);
56+
hir::DeclLocal(ref local) => {
57+
let remainder_extent = CodeExtentData::Remainder(BlockRemainder {
58+
block: block_id,
59+
first_statement_index: index as u32,
60+
});
61+
let remainder_extent =
62+
cx.tcx.region_maps.lookup_code_extent(remainder_extent);
5963

60-
let pattern = Pattern::from_hir(cx.tcx, &local.pat);
61-
result.push(StmtRef::Mirror(Box::new(Stmt {
62-
span: stmt.span,
63-
kind: StmtKind::Let {
64-
remainder_scope: remainder_extent,
65-
init_scope: cx.tcx.region_maps.node_extent(id),
66-
pattern: pattern,
67-
initializer: local.init.to_ref(),
68-
},
69-
})));
64+
let pattern = Pattern::from_hir(cx.tcx, &local.pat);
65+
result.push(StmtRef::Mirror(Box::new(Stmt {
66+
span: stmt.span,
67+
kind: StmtKind::Let {
68+
remainder_scope: remainder_extent,
69+
init_scope: cx.tcx.region_maps.node_extent(id),
70+
pattern: pattern,
71+
initializer: local.init.to_ref(),
72+
},
73+
})));
74+
}
7075
}
7176
}
7277
}

0 commit comments

Comments
 (0)