diff options
Diffstat (limited to 'crates/ra_hir_ty/src/unsafe_validation.rs')
-rw-r--r-- | crates/ra_hir_ty/src/unsafe_validation.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/unsafe_validation.rs b/crates/ra_hir_ty/src/unsafe_validation.rs index f3ce7112a..e2353404b 100644 --- a/crates/ra_hir_ty/src/unsafe_validation.rs +++ b/crates/ra_hir_ty/src/unsafe_validation.rs | |||
@@ -3,7 +3,11 @@ | |||
3 | 3 | ||
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::{DefWithBodyId, FunctionId}; | 6 | use hir_def::{ |
7 | body::Body, | ||
8 | expr::{Expr, ExprId, UnaryOp}, | ||
9 | DefWithBodyId, FunctionId, | ||
10 | }; | ||
7 | use hir_expand::diagnostics::DiagnosticSink; | 11 | use hir_expand::diagnostics::DiagnosticSink; |
8 | 12 | ||
9 | use crate::{ | 13 | use crate::{ |
@@ -11,13 +15,6 @@ use crate::{ | |||
11 | InferenceResult, Ty, TypeCtor, | 15 | InferenceResult, Ty, TypeCtor, |
12 | }; | 16 | }; |
13 | 17 | ||
14 | use rustc_hash::FxHashSet; | ||
15 | |||
16 | use hir_def::{ | ||
17 | body::Body, | ||
18 | expr::{Expr, ExprId, UnaryOp}, | ||
19 | }; | ||
20 | |||
21 | pub struct UnsafeValidator<'a, 'b: 'a> { | 18 | pub struct UnsafeValidator<'a, 'b: 'a> { |
22 | func: FunctionId, | 19 | func: FunctionId, |
23 | infer: Arc<InferenceResult>, | 20 | infer: Arc<InferenceResult>, |
@@ -75,13 +72,9 @@ pub fn unsafe_expressions( | |||
75 | def: DefWithBodyId, | 72 | def: DefWithBodyId, |
76 | ) -> Vec<UnsafeExpr> { | 73 | ) -> Vec<UnsafeExpr> { |
77 | let mut unsafe_exprs = vec![]; | 74 | let mut unsafe_exprs = vec![]; |
78 | let mut unsafe_block_exprs = FxHashSet::default(); | ||
79 | let body = db.body(def); | 75 | let body = db.body(def); |
80 | for (id, expr) in body.exprs.iter() { | 76 | for (id, expr) in body.exprs.iter() { |
81 | match expr { | 77 | match expr { |
82 | Expr::Unsafe { .. } => { | ||
83 | unsafe_block_exprs.insert(id); | ||
84 | } | ||
85 | Expr::Call { callee, .. } => { | 78 | Expr::Call { callee, .. } => { |
86 | let ty = &infer[*callee]; | 79 | let ty = &infer[*callee]; |
87 | if let &Ty::Apply(ApplicationTy { | 80 | if let &Ty::Apply(ApplicationTy { |