@@ -52,14 +52,16 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
52
52
tables : tables,
53
53
graph : graph,
54
54
fn_exit : fn_exit,
55
- loop_scopes : Vec :: new ( )
55
+ loop_scopes : Vec :: new ( ) ,
56
56
} ;
57
57
body_exit = cfg_builder. expr ( & body. value , entry) ;
58
58
cfg_builder. add_contained_edge ( body_exit, fn_exit) ;
59
- let CFGBuilder { graph, ..} = cfg_builder;
60
- CFG { graph : graph,
61
- entry : entry,
62
- exit : fn_exit}
59
+ let CFGBuilder { graph, .. } = cfg_builder;
60
+ CFG {
61
+ graph : graph,
62
+ entry : entry,
63
+ exit : fn_exit,
64
+ }
63
65
}
64
66
65
67
impl < ' a , ' tcx > CFGBuilder < ' a , ' tcx > {
@@ -81,7 +83,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
81
83
self . add_ast_node ( id, & [ exit] )
82
84
}
83
85
84
- hir:: StmtExpr ( ref expr, id) | hir:: StmtSemi ( ref expr, id) => {
86
+ hir:: StmtExpr ( ref expr, id) |
87
+ hir:: StmtSemi ( ref expr, id) => {
85
88
let exit = self . expr ( & expr, pred) ;
86
89
self . add_ast_node ( id, & [ exit] )
87
90
}
@@ -95,9 +98,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
95
98
self . pat ( & local. pat , init_exit)
96
99
}
97
100
98
- hir:: DeclItem ( _) => {
99
- pred
100
- }
101
+ hir:: DeclItem ( _) => pred,
101
102
}
102
103
}
103
104
@@ -107,9 +108,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
107
108
PatKind :: Path ( _) |
108
109
PatKind :: Lit ( ..) |
109
110
PatKind :: Range ( ..) |
110
- PatKind :: Wild => {
111
- self . add_ast_node ( pat. id , & [ pred] )
112
- }
111
+ PatKind :: Wild => self . add_ast_node ( pat. id , & [ pred] ) ,
113
112
114
113
PatKind :: Box ( ref subpat) |
115
114
PatKind :: Ref ( ref subpat, _) |
@@ -125,8 +124,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
125
124
}
126
125
127
126
PatKind :: Struct ( _, ref subpats, _) => {
128
- let pats_exit =
129
- self . pats_all ( subpats. iter ( ) . map ( |f| & f. node . pat ) , pred) ;
127
+ let pats_exit = self . pats_all ( subpats. iter ( ) . map ( |f| & f. node . pat ) , pred) ;
130
128
self . add_ast_node ( pat. id , & [ pats_exit] )
131
129
}
132
130
@@ -385,7 +383,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
385
383
let method_call = ty:: MethodCall :: expr ( call_expr. id ) ;
386
384
let fn_ty = match self . tables . method_map . get ( & method_call) {
387
385
Some ( method) => method. ty ,
388
- None => self . tables . expr_ty_adjusted ( func_or_rcvr)
386
+ None => self . tables . expr_ty_adjusted ( func_or_rcvr) ,
389
387
} ;
390
388
391
389
let func_or_rcvr_exit = self . expr ( func_or_rcvr, pred) ;
@@ -556,7 +554,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
556
554
from_index : CFGIndex ,
557
555
to_loop : LoopScope ,
558
556
to_index : CFGIndex ) {
559
- let mut data = CFGEdgeData { exiting_scopes : vec ! [ ] } ;
557
+ let mut data = CFGEdgeData { exiting_scopes : vec ! [ ] } ;
560
558
let mut scope = self . tcx . region_maps . node_extent ( from_expr. id ) ;
561
559
let target_scope = self . tcx . region_maps . node_extent ( to_loop. loop_id ) ;
562
560
while scope != target_scope {
@@ -591,7 +589,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
591
589
}
592
590
span_bug ! ( expr. span, "no loop scope for id {}" , loop_id) ;
593
591
}
594
- Err ( err) => span_bug ! ( expr. span, "loop scope error: {}" , err)
592
+ Err ( err) => span_bug ! ( expr. span, "loop scope error: {}" , err) ,
595
593
}
596
594
}
597
595
}
0 commit comments