From b1992b469cae689f7de01ea9031962735a409198 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Sat, 27 Jun 2020 11:20:02 -0400 Subject: Remove unneeded code, filename from tests, fix rebasing issues --- crates/ra_hir_ty/src/tests.rs | 5 ----- crates/ra_hir_ty/src/unsafe_validation.rs | 17 +++++------------ 2 files changed, 5 insertions(+), 17 deletions(-) (limited to 'crates/ra_hir_ty') diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index 496cb428b..2a85ce85d 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs @@ -580,7 +580,6 @@ fn missing_unsafe() { fn missing_unsafe_diagnostic_with_unsafe_method_call() { let diagnostics = TestDB::with_files( r" -//- /lib.rs struct HasUnsafe; impl HasUnsafe { @@ -606,7 +605,6 @@ fn missing_unsafe() { fn no_missing_unsafe_diagnostic_with_raw_ptr_in_unsafe_block() { let diagnostics = TestDB::with_files( r" -//- /lib.rs fn nothing_to_see_move_along() { let x = &5 as *const usize; unsafe { @@ -625,7 +623,6 @@ fn nothing_to_see_move_along() { fn missing_unsafe_diagnostic_with_raw_ptr_outside_unsafe_block() { let diagnostics = TestDB::with_files( r" -//- /lib.rs fn nothing_to_see_move_along() { let x = &5 as *const usize; unsafe { @@ -645,7 +642,6 @@ fn nothing_to_see_move_along() { fn no_missing_unsafe_diagnostic_with_unsafe_call_in_unsafe_block() { let diagnostics = TestDB::with_files( r" -//- /lib.rs unsafe fn unsafe_fn() { let x = &5 as *const usize; let y = *x; @@ -668,7 +664,6 @@ fn nothing_to_see_move_along() { fn no_missing_unsafe_diagnostic_with_unsafe_method_call_in_unsafe_block() { let diagnostics = TestDB::with_files( r" -//- /lib.rs struct HasUnsafe; impl HasUnsafe { 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 @@ use std::sync::Arc; -use hir_def::{DefWithBodyId, FunctionId}; +use hir_def::{ + body::Body, + expr::{Expr, ExprId, UnaryOp}, + DefWithBodyId, FunctionId, +}; use hir_expand::diagnostics::DiagnosticSink; use crate::{ @@ -11,13 +15,6 @@ use crate::{ InferenceResult, Ty, TypeCtor, }; -use rustc_hash::FxHashSet; - -use hir_def::{ - body::Body, - expr::{Expr, ExprId, UnaryOp}, -}; - pub struct UnsafeValidator<'a, 'b: 'a> { func: FunctionId, infer: Arc, @@ -75,13 +72,9 @@ pub fn unsafe_expressions( def: DefWithBodyId, ) -> Vec { let mut unsafe_exprs = vec![]; - let mut unsafe_block_exprs = FxHashSet::default(); let body = db.body(def); for (id, expr) in body.exprs.iter() { match expr { - Expr::Unsafe { .. } => { - unsafe_block_exprs.insert(id); - } Expr::Call { callee, .. } => { let ty = &infer[*callee]; if let &Ty::Apply(ApplicationTy { -- cgit v1.2.3