aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
-rw-r--r--crates/hir_ty/src/diagnostics/unsafe_check.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs
index 6dc862826..9c506112d 100644
--- a/crates/hir_ty/src/diagnostics/unsafe_check.rs
+++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs
@@ -12,8 +12,7 @@ use hir_def::{
12use hir_expand::diagnostics::DiagnosticSink; 12use hir_expand::diagnostics::DiagnosticSink;
13 13
14use crate::{ 14use crate::{
15 db::HirDatabase, diagnostics::MissingUnsafe, lower::CallableDefId, ApplicationTy, 15 db::HirDatabase, diagnostics::MissingUnsafe, ApplicationTy, InferenceResult, Ty, TypeCtor,
16 InferenceResult, Ty, TypeCtor,
17}; 16};
18 17
19pub(super) struct UnsafeValidator<'a, 'b: 'a> { 18pub(super) struct UnsafeValidator<'a, 'b: 'a> {
@@ -87,13 +86,8 @@ fn walk_unsafe(
87) { 86) {
88 let expr = &body.exprs[current]; 87 let expr = &body.exprs[current];
89 match expr { 88 match expr {
90 Expr::Call { callee, .. } => { 89 &Expr::Call { callee, .. } => {
91 let ty = &infer[*callee]; 90 if let Some(func) = infer[callee].as_fn_def() {
92 if let &Ty::Apply(ApplicationTy {
93 ctor: TypeCtor::FnDef(CallableDefId::FunctionId(func)),
94 ..
95 }) = ty
96 {
97 if db.function_data(func).is_unsafe { 91 if db.function_data(func).is_unsafe {
98 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block }); 92 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block });
99 } 93 }