aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/unsafe_validation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/unsafe_validation.rs')
-rw-r--r--crates/ra_hir_ty/src/unsafe_validation.rs17
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
4use std::sync::Arc; 4use std::sync::Arc;
5 5
6use hir_def::{DefWithBodyId, FunctionId}; 6use hir_def::{
7 body::Body,
8 expr::{Expr, ExprId, UnaryOp},
9 DefWithBodyId, FunctionId,
10};
7use hir_expand::diagnostics::DiagnosticSink; 11use hir_expand::diagnostics::DiagnosticSink;
8 12
9use crate::{ 13use crate::{
@@ -11,13 +15,6 @@ use crate::{
11 InferenceResult, Ty, TypeCtor, 15 InferenceResult, Ty, TypeCtor,
12}; 16};
13 17
14use rustc_hash::FxHashSet;
15
16use hir_def::{
17 body::Body,
18 expr::{Expr, ExprId, UnaryOp},
19};
20
21pub struct UnsafeValidator<'a, 'b: 'a> { 18pub 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 {