File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ pub struct TransformVisitor {
31
31
}
32
32
33
33
impl TransformVisitor {
34
- fn is_removal_target ( & mut self , call_expr : & mut CallExpr ) -> bool {
34
+ fn is_removal_target ( & mut self , call_expr : & CallExpr ) -> bool {
35
35
match call_expr. callee {
36
36
Callee :: Expr ( ref expr) => {
37
37
match expr. as_ref ( ) {
@@ -97,30 +97,14 @@ impl VisitMut for TransformVisitor {
97
97
} ) ;
98
98
}
99
99
100
- fn visit_mut_expr_stmt ( & mut self , n : & mut ExprStmt ) {
100
+ fn visit_mut_stmt ( & mut self , n : & mut Stmt ) {
101
101
if self . target_variables . is_empty ( ) {
102
102
n. visit_mut_children_with ( self ) ;
103
103
return ;
104
104
}
105
- match n. expr . as_mut ( ) {
106
- Expr :: Call ( call_expr) => {
107
- if self . is_removal_target ( call_expr) {
108
- call_expr. take ( ) ;
109
- } else {
110
- n. visit_mut_children_with ( self ) ;
111
- }
112
- } ,
113
- _ => {
114
- n. visit_mut_children_with ( self ) ;
115
- }
116
- }
117
- }
118
-
119
- fn visit_mut_stmt ( & mut self , n : & mut Stmt ) {
120
- n. visit_mut_children_with ( self ) ;
121
105
if let Stmt :: Expr ( ExprStmt { expr, ..} ) = n {
122
106
if let Expr :: Call ( call_expr) = expr. as_ref ( ) {
123
- if * call_expr == CallExpr :: dummy ( ) {
107
+ if self . is_removal_target ( call_expr ) {
124
108
n. take ( ) ;
125
109
}
126
110
}
You can’t perform that action at this time.
0 commit comments