aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorPaul Daniel Faria <[email protected]>2020-06-27 17:00:46 +0100
committerPaul Daniel Faria <[email protected]>2020-06-27 17:00:46 +0100
commit68a649d547c844cb44ee619b7f45d1193dad2b02 (patch)
treec5da78ae4eff38e88a7dace20a5dcbd913b6224a /crates
parentb7e25ba854a5ca0f1dee7082c113170876358632 (diff)
Simplify unsafe expr collection match
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/unsafe_validation.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/unsafe_validation.rs b/crates/ra_hir_ty/src/unsafe_validation.rs
index aad13d99c..c512c4f8e 100644
--- a/crates/ra_hir_ty/src/unsafe_validation.rs
+++ b/crates/ra_hir_ty/src/unsafe_validation.rs
@@ -108,13 +108,12 @@ fn walk_unsafe(
108 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block }); 108 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block });
109 } 109 }
110 } 110 }
111 Expr::Unsafe { body: child } => {
112 return walk_unsafe(unsafe_exprs, db, infer, body, *child, true);
113 }
111 _ => {} 114 _ => {}
112 } 115 }
113 116
114 if let &Expr::Unsafe { body: child } = expr {
115 return walk_unsafe(unsafe_exprs, db, infer, body, child, true);
116 }
117
118 expr.walk_child_exprs(|child| { 117 expr.walk_child_exprs(|child| {
119 walk_unsafe(unsafe_exprs, db, infer, body, child, inside_unsafe_block); 118 walk_unsafe(unsafe_exprs, db, infer, body, child, inside_unsafe_block);
120 }); 119 });