diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 89f60902cf9d2..34f66fc0fdaf4 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -1,11 +1,13 @@ use crate::build::ExprCategory; +use hir::intravisit; +use rustc_data_structures::fx::FxHashMap; use rustc_middle::thir::visit::{self, Visitor}; use rustc_errors::struct_span_err; use rustc_hir as hir; -use rustc_middle::mir::BorrowKind; -use rustc_middle::thir::*; +use rustc_middle::mir::{BorrowKind, UnusedUnsafe, UsedUnsafeBlockData}; use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt}; +use rustc_middle::{lint, thir::*}; use rustc_session::lint::builtin::{UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE}; use rustc_session::lint::Level; use rustc_span::def_id::{DefId, LocalDefId}; @@ -13,6 +15,7 @@ use rustc_span::symbol::Symbol; use rustc_span::Span; use std::borrow::Cow; +use std::collections::hash_map; use std::ops::Bound; struct UnsafetyVisitor<'a, 'tcx> { @@ -24,7 +27,6 @@ struct UnsafetyVisitor<'a, 'tcx> { /// The current "safety context". This notably tracks whether we are in an /// `unsafe` block, and whether it has been used. safety_context: SafetyContext, - body_unsafety: BodyUnsafety, /// The `#[target_feature]` attributes of the body. Used for checking /// calls to functions with `#[target_feature]` (RFC 2396). body_target_features: &'tcx [Symbol], @@ -34,51 +36,41 @@ struct UnsafetyVisitor<'a, 'tcx> { in_union_destructure: bool, param_env: ParamEnv<'tcx>, inside_adt: bool, + used_unsafe_blocks: &'a mut FxHashMap, } impl<'tcx> UnsafetyVisitor<'_, 'tcx> { fn in_safety_context(&mut self, safety_context: SafetyContext, f: impl FnOnce(&mut Self)) { - if let ( - SafetyContext::UnsafeBlock { span: enclosing_span, .. }, - SafetyContext::UnsafeBlock { span: block_span, hir_id, .. }, - ) = (self.safety_context, safety_context) - { - self.warn_unused_unsafe( - hir_id, - block_span, - Some((self.tcx.sess.source_map().guess_head_span(enclosing_span), "block")), - ); - f(self); - } else { - let prev_context = self.safety_context; - self.safety_context = safety_context; + let prev_context = self.safety_context; + self.safety_context = safety_context; - f(self); + f(self); - if let SafetyContext::UnsafeBlock { used: false, span, hir_id } = self.safety_context { - self.warn_unused_unsafe( - hir_id, - span, - if self.unsafe_op_in_unsafe_fn_allowed() { - self.body_unsafety.unsafe_fn_sig_span().map(|span| (span, "fn")) - } else { - None - }, - ); - } - self.safety_context = prev_context; - } + self.safety_context = prev_context; } fn requires_unsafe(&mut self, span: Span, kind: UnsafeOpKind) { + use UsedUnsafeBlockData::{AllAllowedInUnsafeFn, SomeDisallowedInUnsafeFn}; + let unsafe_op_in_unsafe_fn_allowed = self.unsafe_op_in_unsafe_fn_allowed(); match self.safety_context { SafetyContext::BuiltinUnsafeBlock => {} - SafetyContext::UnsafeBlock { ref mut used, .. } => { - if !self.body_unsafety.is_unsafe() || !unsafe_op_in_unsafe_fn_allowed { - // Mark this block as useful - *used = true; - } + SafetyContext::UnsafeBlock(hir_id) => { + let new_usage = if unsafe_op_in_unsafe_fn_allowed { + AllAllowedInUnsafeFn(self.hir_context) + } else { + SomeDisallowedInUnsafeFn + }; + match self.used_unsafe_blocks.entry(hir_id) { + hash_map::Entry::Occupied(mut entry) => { + if new_usage == SomeDisallowedInUnsafeFn { + *entry.get_mut() = SomeDisallowedInUnsafeFn; + } + } + hash_map::Entry::Vacant(entry) => { + entry.insert(new_usage); + } + }; } SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {} SafetyContext::UnsafeFn => { @@ -117,24 +109,6 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { } } - fn warn_unused_unsafe( - &self, - hir_id: hir::HirId, - block_span: Span, - enclosing_unsafe: Option<(Span, &'static str)>, - ) { - let block_span = self.tcx.sess.source_map().guess_head_span(block_span); - self.tcx.struct_span_lint_hir(UNUSED_UNSAFE, hir_id, block_span, |lint| { - let msg = "unnecessary `unsafe` block"; - let mut db = lint.build(msg); - db.span_label(block_span, msg); - if let Some((span, kind)) = enclosing_unsafe { - db.span_label(span, format!("because it's nested under this `unsafe` {}", kind)); - } - db.emit(); - }); - } - /// Whether the `unsafe_op_in_unsafe_fn` lint is `allow`ed at the current HIR node. fn unsafe_op_in_unsafe_fn_allowed(&self) -> bool { self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, self.hir_context).0 == Level::Allow @@ -200,10 +174,9 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { }); } BlockSafety::ExplicitUnsafe(hir_id) => { - self.in_safety_context( - SafetyContext::UnsafeBlock { span: block.span, hir_id, used: false }, - |this| visit::walk_block(this, block), - ); + self.in_safety_context(SafetyContext::UnsafeBlock(hir_id), |this| { + visit::walk_block(this, block) + }); } BlockSafety::Safe => { visit::walk_block(self, block); @@ -421,8 +394,12 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { }); let closure_thir = &closure_thir.borrow(); let hir_context = self.tcx.hir().local_def_id_to_hir_id(closure_id); - let mut closure_visitor = - UnsafetyVisitor { thir: closure_thir, hir_context, ..*self }; + let mut closure_visitor = UnsafetyVisitor { + thir: closure_thir, + hir_context, + used_unsafe_blocks: self.used_unsafe_blocks, + ..*self + }; closure_visitor.visit_expr(&closure_thir[expr]); // Unsafe blocks can be used in closures, make sure to take it into account self.safety_context = closure_visitor.safety_context; @@ -495,7 +472,7 @@ enum SafetyContext { Safe, BuiltinUnsafeBlock, UnsafeFn, - UnsafeBlock { span: Span, hir_id: hir::HirId, used: bool }, + UnsafeBlock(hir::HirId), } #[derive(Clone, Copy)] @@ -512,14 +489,6 @@ impl BodyUnsafety { fn is_unsafe(&self) -> bool { matches!(self, BodyUnsafety::Unsafe(_)) } - - /// If the body is unsafe, returns the `Span` of its signature. - fn unsafe_fn_sig_span(self) -> Option { - match self { - BodyUnsafety::Unsafe(span) => Some(span), - BodyUnsafety::Safe => None, - } - } } #[derive(Clone, Copy, PartialEq)] @@ -616,6 +585,106 @@ impl UnsafeOpKind { } } +/// Context information for [`UnusedUnsafeVisitor`] traversal, +/// saves (innermost) relevant context +#[derive(Copy, Clone, Debug)] +enum Context { + Safe, + /// in an `unsafe fn` + UnsafeFn(hir::HirId), + /// in a *used* `unsafe` block + /// (i.e. a block without unused-unsafe warning) + UnsafeBlock(hir::HirId), +} + +struct UnusedUnsafeVisitor<'a, 'tcx> { + tcx: TyCtxt<'tcx>, + used_unsafe_blocks: &'a FxHashMap, + context: Context, +} + +impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> { + fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) { + use UsedUnsafeBlockData::{AllAllowedInUnsafeFn, SomeDisallowedInUnsafeFn}; + + if let hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::UserProvided) = block.rules { + let used = match self.tcx.lint_level_at_node(UNUSED_UNSAFE, block.hir_id) { + (Level::Allow, _) => Some(SomeDisallowedInUnsafeFn), + _ => self.used_unsafe_blocks.get(&block.hir_id).copied(), + }; + let unused_unsafe = match (self.context, used) { + (_, None) => UnusedUnsafe::Unused, + (Context::Safe, Some(_)) + | (Context::UnsafeFn(_), Some(SomeDisallowedInUnsafeFn)) => { + let previous_context = self.context; + self.context = Context::UnsafeBlock(block.hir_id); + intravisit::walk_block(self, block); + self.context = previous_context; + return; + } + (Context::UnsafeFn(hir_id), Some(AllAllowedInUnsafeFn(lint_root))) => { + UnusedUnsafe::InUnsafeFn(hir_id, lint_root) + } + (Context::UnsafeBlock(hir_id), Some(_)) => UnusedUnsafe::InUnsafeBlock(hir_id), + }; + report_unused_unsafe(self.tcx, block.hir_id, unused_unsafe); + } + intravisit::walk_block(self, block); + } + + fn visit_fn( + &mut self, + fk: intravisit::FnKind<'tcx>, + _fd: &'tcx hir::FnDecl<'tcx>, + b: hir::BodyId, + _s: rustc_span::Span, + _id: hir::HirId, + ) { + if matches!(fk, intravisit::FnKind::Closure) { + self.visit_body(self.tcx.hir().body(b)) + } + } +} + +fn report_unused_unsafe(tcx: TyCtxt<'_>, id: hir::HirId, kind: UnusedUnsafe) { + let span = tcx.sess.source_map().guess_head_span(tcx.hir().span(id)); + tcx.struct_span_lint_hir(UNUSED_UNSAFE, id, span, |lint| { + let msg = "unnecessary `unsafe` block"; + let mut db = lint.build(msg); + db.span_label(span, msg); + match kind { + UnusedUnsafe::Unused => {} + UnusedUnsafe::InUnsafeBlock(id) => { + db.span_label( + tcx.sess.source_map().guess_head_span(tcx.hir().span(id)), + format!("because it's nested under this `unsafe` block"), + ); + } + UnusedUnsafe::InUnsafeFn(id, usage_lint_root) => { + db.span_label( + tcx.sess.source_map().guess_head_span(tcx.hir().span(id)), + format!("because it's nested under this `unsafe` fn"), + ) + .note( + "this `unsafe` block does contain unsafe operations, \ + but those are already allowed in an `unsafe fn`", + ); + let (level, source) = + tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, usage_lint_root); + assert_eq!(level, Level::Allow); + lint::explain_lint_level_source( + UNSAFE_OP_IN_UNSAFE_FN, + Level::Allow, + source, + &mut db, + ); + } + } + + db.emit(); + }); +} + pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam) { // THIR unsafeck is gated under `-Z thir-unsafeck` if !tcx.sess.opts.unstable_opts.thir_unsafeck { @@ -655,14 +724,20 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam(tcx: TyCtxt<'tcx>, def_id: LocalDefId) { diff --git a/src/test/ui/span/lint-unused-unsafe-thir.rs b/src/test/ui/span/lint-unused-unsafe-thir.rs deleted file mode 100644 index 95a537ed28230..0000000000000 --- a/src/test/ui/span/lint-unused-unsafe-thir.rs +++ /dev/null @@ -1,61 +0,0 @@ -// FIXME: This file is tracking old lint behavior that's still unchanged in the -// unstable -Zthir-unsafeck implementation. See lint-unused-unsafe.rs for more details. -// -// Exercise the unused_unsafe attribute in some positive and negative cases - -// compile-flags: -Zthir-unsafeck - -#![allow(dead_code)] -#![deny(unused_unsafe)] - - -mod foo { - extern "C" { - pub fn bar(); - } -} - -fn callback(_f: F) -> T where F: FnOnce() -> T { panic!() } -unsafe fn unsf() {} - -fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block -fn bad6() { - unsafe { // don't put the warning here - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} -unsafe fn bad7() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} - -unsafe fn good0() { unsf() } -fn good1() { unsafe { unsf() } } -fn good2() { - /* bug uncovered when implementing warning about unused unsafe blocks. Be - sure that when purity is inherited that the source of the unsafe-ness - is tracked correctly */ - unsafe { - unsafe fn what() -> Vec { panic!() } - - callback(|| { - what(); - }); - } -} - -unsafe fn good3() { foo::bar() } -fn good4() { unsafe { foo::bar() } } - -#[allow(unused_unsafe)] fn allowed() { unsafe {} } - -fn main() {} diff --git a/src/test/ui/span/lint-unused-unsafe-thir.stderr b/src/test/ui/span/lint-unused-unsafe-thir.stderr deleted file mode 100644 index 6654910c5cdc3..0000000000000 --- a/src/test/ui/span/lint-unused-unsafe-thir.stderr +++ /dev/null @@ -1,66 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:21:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe-thir.rs:9:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:22:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:23:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:24:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:25:20 - | -LL | unsafe fn bad5() { unsafe { unsf() } } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:28:9 - | -LL | unsafe { // don't put the warning here - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:35:9 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:34:5 - | -LL | unsafe fn bad7() { - | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 8 previous errors - diff --git a/src/test/ui/span/lint-unused-unsafe.mir.stderr b/src/test/ui/span/lint-unused-unsafe.mir.stderr index 850550a1d8f70..4df96ea3779bb 100644 --- a/src/test/ui/span/lint-unused-unsafe.mir.stderr +++ b/src/test/ui/span/lint-unused-unsafe.mir.stderr @@ -1,35 +1,35 @@ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:26:13 + --> $DIR/lint-unused-unsafe.rs:21:13 | LL | fn bad1() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:14:9 + --> $DIR/lint-unused-unsafe.rs:9:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:27:13 + --> $DIR/lint-unused-unsafe.rs:22:13 | LL | fn bad2() { unsafe { bad1() } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:20 + --> $DIR/lint-unused-unsafe.rs:23:20 | LL | unsafe fn bad3() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:29:13 + --> $DIR/lint-unused-unsafe.rs:24:13 | LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:30:20 + --> $DIR/lint-unused-unsafe.rs:25:20 | LL | unsafe fn bad5() { unsafe { unsf() } } | ---------------- ^^^^^^ unnecessary `unsafe` block @@ -40,19 +40,19 @@ LL | unsafe fn bad5() { unsafe { unsf() } } = note: `#[allow(unsafe_op_in_unsafe_fn)]` on by default error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:32:5 + --> $DIR/lint-unused-unsafe.rs:27:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:39:5 + --> $DIR/lint-unused-unsafe.rs:34:5 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:40:9 + --> $DIR/lint-unused-unsafe.rs:35:9 | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn @@ -63,37 +63,37 @@ LL | unsafe { = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:74:9 + --> $DIR/lint-unused-unsafe.rs:69:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:83:9 + --> $DIR/lint-unused-unsafe.rs:78:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:84:13 + --> $DIR/lint-unused-unsafe.rs:79:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:85:13 + --> $DIR/lint-unused-unsafe.rs:80:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:90:9 + --> $DIR/lint-unused-unsafe.rs:85:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:100:13 + --> $DIR/lint-unused-unsafe.rs:95:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -102,7 +102,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:101:13 + --> $DIR/lint-unused-unsafe.rs:96:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -111,7 +111,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:102:13 + --> $DIR/lint-unused-unsafe.rs:97:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -120,7 +120,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:112:17 + --> $DIR/lint-unused-unsafe.rs:107:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -129,13 +129,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:110:20 + --> $DIR/lint-unused-unsafe.rs:105:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:113:17 + --> $DIR/lint-unused-unsafe.rs:108:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -144,7 +144,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:114:17 + --> $DIR/lint-unused-unsafe.rs:109:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -153,37 +153,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:124:9 + --> $DIR/lint-unused-unsafe.rs:119:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:134:9 + --> $DIR/lint-unused-unsafe.rs:129:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:135:13 + --> $DIR/lint-unused-unsafe.rs:130:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:136:13 + --> $DIR/lint-unused-unsafe.rs:131:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:142:9 + --> $DIR/lint-unused-unsafe.rs:137:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:153:13 + --> $DIR/lint-unused-unsafe.rs:148:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -192,7 +192,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:154:13 + --> $DIR/lint-unused-unsafe.rs:149:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -201,7 +201,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:155:13 + --> $DIR/lint-unused-unsafe.rs:150:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -210,7 +210,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:166:17 + --> $DIR/lint-unused-unsafe.rs:161:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -219,13 +219,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:164:20 + --> $DIR/lint-unused-unsafe.rs:159:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:167:17 + --> $DIR/lint-unused-unsafe.rs:162:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -234,7 +234,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:168:17 + --> $DIR/lint-unused-unsafe.rs:163:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -243,37 +243,37 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:178:9 + --> $DIR/lint-unused-unsafe.rs:173:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:188:9 + --> $DIR/lint-unused-unsafe.rs:183:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:189:13 + --> $DIR/lint-unused-unsafe.rs:184:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:190:13 + --> $DIR/lint-unused-unsafe.rs:185:13 | LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:196:9 + --> $DIR/lint-unused-unsafe.rs:191:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:197:13 + --> $DIR/lint-unused-unsafe.rs:192:13 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -283,13 +283,13 @@ LL | unsafe { unsf() } | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:194:13 + --> $DIR/lint-unused-unsafe.rs:189:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:198:13 + --> $DIR/lint-unused-unsafe.rs:193:13 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -300,7 +300,7 @@ LL | unsafe { unsf() } = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:199:13 + --> $DIR/lint-unused-unsafe.rs:194:13 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -311,7 +311,7 @@ LL | unsafe { unsf() } = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:205:9 + --> $DIR/lint-unused-unsafe.rs:200:9 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -320,13 +320,13 @@ LL | unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:203:13 + --> $DIR/lint-unused-unsafe.rs:198:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:207:13 + --> $DIR/lint-unused-unsafe.rs:202:13 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -337,7 +337,7 @@ LL | unsafe { unsf() } = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:208:13 + --> $DIR/lint-unused-unsafe.rs:203:13 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -348,7 +348,7 @@ LL | unsafe { unsf() } = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:209:13 + --> $DIR/lint-unused-unsafe.rs:204:13 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -359,7 +359,7 @@ LL | unsafe { unsf() } = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:220:17 + --> $DIR/lint-unused-unsafe.rs:215:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -368,13 +368,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:218:20 + --> $DIR/lint-unused-unsafe.rs:213:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:221:17 + --> $DIR/lint-unused-unsafe.rs:216:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -383,7 +383,7 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:222:17 + --> $DIR/lint-unused-unsafe.rs:217:17 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -392,13 +392,13 @@ LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:242:9 + --> $DIR/lint-unused-unsafe.rs:237:9 | LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:254:9 + --> $DIR/lint-unused-unsafe.rs:249:9 | LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { | ----------------------------------------------- because it's nested under this `unsafe` fn @@ -407,13 +407,13 @@ LL | unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:252:13 + --> $DIR/lint-unused-unsafe.rs:247:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:268:13 + --> $DIR/lint-unused-unsafe.rs:263:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -421,37 +421,37 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:286:20 + --> $DIR/lint-unused-unsafe.rs:281:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:295:20 + --> $DIR/lint-unused-unsafe.rs:290:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:296:24 + --> $DIR/lint-unused-unsafe.rs:291:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:297:24 + --> $DIR/lint-unused-unsafe.rs:292:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:302:20 + --> $DIR/lint-unused-unsafe.rs:297:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:312:24 + --> $DIR/lint-unused-unsafe.rs:307:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -460,7 +460,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:313:24 + --> $DIR/lint-unused-unsafe.rs:308:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -469,7 +469,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:314:24 + --> $DIR/lint-unused-unsafe.rs:309:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -478,7 +478,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:324:28 + --> $DIR/lint-unused-unsafe.rs:319:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -487,13 +487,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:322:20 + --> $DIR/lint-unused-unsafe.rs:317:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:325:28 + --> $DIR/lint-unused-unsafe.rs:320:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -502,7 +502,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:326:28 + --> $DIR/lint-unused-unsafe.rs:321:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -511,37 +511,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:336:20 + --> $DIR/lint-unused-unsafe.rs:331:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:346:20 + --> $DIR/lint-unused-unsafe.rs:341:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:347:24 + --> $DIR/lint-unused-unsafe.rs:342:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:348:24 + --> $DIR/lint-unused-unsafe.rs:343:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:354:20 + --> $DIR/lint-unused-unsafe.rs:349:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:365:24 + --> $DIR/lint-unused-unsafe.rs:360:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -550,7 +550,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:366:24 + --> $DIR/lint-unused-unsafe.rs:361:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -559,7 +559,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:367:24 + --> $DIR/lint-unused-unsafe.rs:362:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -568,7 +568,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:378:28 + --> $DIR/lint-unused-unsafe.rs:373:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -577,13 +577,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:376:20 + --> $DIR/lint-unused-unsafe.rs:371:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:379:28 + --> $DIR/lint-unused-unsafe.rs:374:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -592,7 +592,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:380:28 + --> $DIR/lint-unused-unsafe.rs:375:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -601,37 +601,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:390:20 + --> $DIR/lint-unused-unsafe.rs:385:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:400:20 + --> $DIR/lint-unused-unsafe.rs:395:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:401:24 + --> $DIR/lint-unused-unsafe.rs:396:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:402:24 + --> $DIR/lint-unused-unsafe.rs:397:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:408:20 + --> $DIR/lint-unused-unsafe.rs:403:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:409:24 + --> $DIR/lint-unused-unsafe.rs:404:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -641,13 +641,13 @@ LL | let _ = || unsafe { unsf() }; | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:406:13 + --> $DIR/lint-unused-unsafe.rs:401:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:410:24 + --> $DIR/lint-unused-unsafe.rs:405:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -658,7 +658,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:411:24 + --> $DIR/lint-unused-unsafe.rs:406:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -669,7 +669,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:417:20 + --> $DIR/lint-unused-unsafe.rs:412:20 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -678,13 +678,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:415:13 + --> $DIR/lint-unused-unsafe.rs:410:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:419:24 + --> $DIR/lint-unused-unsafe.rs:414:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -695,7 +695,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:420:24 + --> $DIR/lint-unused-unsafe.rs:415:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -706,7 +706,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:421:24 + --> $DIR/lint-unused-unsafe.rs:416:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -717,7 +717,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:432:28 + --> $DIR/lint-unused-unsafe.rs:427:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -726,13 +726,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:430:20 + --> $DIR/lint-unused-unsafe.rs:425:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:433:28 + --> $DIR/lint-unused-unsafe.rs:428:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -741,7 +741,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:434:28 + --> $DIR/lint-unused-unsafe.rs:429:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -750,13 +750,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:454:20 + --> $DIR/lint-unused-unsafe.rs:449:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:466:20 + --> $DIR/lint-unused-unsafe.rs:461:20 | LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { | ----------------------------------------------- because it's nested under this `unsafe` fn @@ -765,13 +765,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:464:13 + --> $DIR/lint-unused-unsafe.rs:459:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:480:24 + --> $DIR/lint-unused-unsafe.rs:475:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -779,37 +779,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:499:20 + --> $DIR/lint-unused-unsafe.rs:494:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:508:20 + --> $DIR/lint-unused-unsafe.rs:503:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:509:24 + --> $DIR/lint-unused-unsafe.rs:504:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:510:24 + --> $DIR/lint-unused-unsafe.rs:505:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:515:20 + --> $DIR/lint-unused-unsafe.rs:510:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:525:24 + --> $DIR/lint-unused-unsafe.rs:520:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -818,7 +818,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:526:24 + --> $DIR/lint-unused-unsafe.rs:521:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -827,7 +827,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:527:24 + --> $DIR/lint-unused-unsafe.rs:522:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -836,7 +836,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:537:28 + --> $DIR/lint-unused-unsafe.rs:532:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -845,13 +845,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:535:20 + --> $DIR/lint-unused-unsafe.rs:530:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:538:28 + --> $DIR/lint-unused-unsafe.rs:533:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -860,7 +860,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:539:28 + --> $DIR/lint-unused-unsafe.rs:534:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -869,37 +869,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:549:20 + --> $DIR/lint-unused-unsafe.rs:544:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:559:20 + --> $DIR/lint-unused-unsafe.rs:554:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:560:24 + --> $DIR/lint-unused-unsafe.rs:555:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:561:24 + --> $DIR/lint-unused-unsafe.rs:556:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:567:20 + --> $DIR/lint-unused-unsafe.rs:562:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:578:24 + --> $DIR/lint-unused-unsafe.rs:573:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -908,7 +908,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:579:24 + --> $DIR/lint-unused-unsafe.rs:574:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -917,7 +917,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:580:24 + --> $DIR/lint-unused-unsafe.rs:575:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -926,7 +926,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:591:28 + --> $DIR/lint-unused-unsafe.rs:586:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -935,13 +935,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:589:20 + --> $DIR/lint-unused-unsafe.rs:584:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:592:28 + --> $DIR/lint-unused-unsafe.rs:587:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -950,7 +950,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:593:28 + --> $DIR/lint-unused-unsafe.rs:588:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -959,37 +959,37 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:603:20 + --> $DIR/lint-unused-unsafe.rs:598:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:613:20 + --> $DIR/lint-unused-unsafe.rs:608:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:614:24 + --> $DIR/lint-unused-unsafe.rs:609:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:615:24 + --> $DIR/lint-unused-unsafe.rs:610:24 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:621:20 + --> $DIR/lint-unused-unsafe.rs:616:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:622:24 + --> $DIR/lint-unused-unsafe.rs:617:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -999,13 +999,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:619:13 + --> $DIR/lint-unused-unsafe.rs:614:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:623:24 + --> $DIR/lint-unused-unsafe.rs:618:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1016,7 +1016,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:624:24 + --> $DIR/lint-unused-unsafe.rs:619:24 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1027,7 +1027,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:630:20 + --> $DIR/lint-unused-unsafe.rs:625:20 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1036,13 +1036,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:628:13 + --> $DIR/lint-unused-unsafe.rs:623:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:632:24 + --> $DIR/lint-unused-unsafe.rs:627:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1053,7 +1053,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:633:24 + --> $DIR/lint-unused-unsafe.rs:628:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1064,7 +1064,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:634:24 + --> $DIR/lint-unused-unsafe.rs:629:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1075,7 +1075,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:645:28 + --> $DIR/lint-unused-unsafe.rs:640:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1084,13 +1084,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:643:20 + --> $DIR/lint-unused-unsafe.rs:638:20 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:646:28 + --> $DIR/lint-unused-unsafe.rs:641:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1099,7 +1099,7 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:647:28 + --> $DIR/lint-unused-unsafe.rs:642:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1108,13 +1108,13 @@ LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:667:20 + --> $DIR/lint-unused-unsafe.rs:662:20 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:679:20 + --> $DIR/lint-unused-unsafe.rs:674:20 | LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { | ----------------------------------------------- because it's nested under this `unsafe` fn @@ -1123,13 +1123,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:677:13 + --> $DIR/lint-unused-unsafe.rs:672:13 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:693:24 + --> $DIR/lint-unused-unsafe.rs:688:24 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1137,37 +1137,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:711:24 + --> $DIR/lint-unused-unsafe.rs:706:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:721:24 + --> $DIR/lint-unused-unsafe.rs:716:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:722:28 + --> $DIR/lint-unused-unsafe.rs:717:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:723:28 + --> $DIR/lint-unused-unsafe.rs:718:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:729:24 + --> $DIR/lint-unused-unsafe.rs:724:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:740:28 + --> $DIR/lint-unused-unsafe.rs:735:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1176,7 +1176,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:741:28 + --> $DIR/lint-unused-unsafe.rs:736:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1185,7 +1185,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:742:28 + --> $DIR/lint-unused-unsafe.rs:737:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1194,7 +1194,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:753:32 + --> $DIR/lint-unused-unsafe.rs:748:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1203,13 +1203,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:751:24 + --> $DIR/lint-unused-unsafe.rs:746:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:754:32 + --> $DIR/lint-unused-unsafe.rs:749:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1218,7 +1218,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:755:32 + --> $DIR/lint-unused-unsafe.rs:750:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1227,37 +1227,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:765:24 + --> $DIR/lint-unused-unsafe.rs:760:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:775:24 + --> $DIR/lint-unused-unsafe.rs:770:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:776:28 + --> $DIR/lint-unused-unsafe.rs:771:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:777:28 + --> $DIR/lint-unused-unsafe.rs:772:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:783:24 + --> $DIR/lint-unused-unsafe.rs:778:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:784:28 + --> $DIR/lint-unused-unsafe.rs:779:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1267,13 +1267,13 @@ LL | let _ = || unsafe { unsf() }; | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:781:17 + --> $DIR/lint-unused-unsafe.rs:776:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:785:28 + --> $DIR/lint-unused-unsafe.rs:780:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1284,7 +1284,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:786:28 + --> $DIR/lint-unused-unsafe.rs:781:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1295,7 +1295,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:792:24 + --> $DIR/lint-unused-unsafe.rs:787:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1304,13 +1304,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:790:17 + --> $DIR/lint-unused-unsafe.rs:785:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:794:28 + --> $DIR/lint-unused-unsafe.rs:789:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1321,7 +1321,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:795:28 + --> $DIR/lint-unused-unsafe.rs:790:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1332,7 +1332,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:796:28 + --> $DIR/lint-unused-unsafe.rs:791:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1343,7 +1343,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:807:32 + --> $DIR/lint-unused-unsafe.rs:802:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1352,13 +1352,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:805:24 + --> $DIR/lint-unused-unsafe.rs:800:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:808:32 + --> $DIR/lint-unused-unsafe.rs:803:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1367,7 +1367,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:809:32 + --> $DIR/lint-unused-unsafe.rs:804:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1376,13 +1376,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:829:24 + --> $DIR/lint-unused-unsafe.rs:824:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:841:24 + --> $DIR/lint-unused-unsafe.rs:836:24 | LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { | ----------------------------------------------- because it's nested under this `unsafe` fn @@ -1391,13 +1391,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:839:17 + --> $DIR/lint-unused-unsafe.rs:834:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:855:28 + --> $DIR/lint-unused-unsafe.rs:850:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1405,37 +1405,37 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:869:24 + --> $DIR/lint-unused-unsafe.rs:864:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:879:24 + --> $DIR/lint-unused-unsafe.rs:874:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:880:28 + --> $DIR/lint-unused-unsafe.rs:875:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:881:28 + --> $DIR/lint-unused-unsafe.rs:876:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:887:24 + --> $DIR/lint-unused-unsafe.rs:882:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:898:28 + --> $DIR/lint-unused-unsafe.rs:893:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1444,7 +1444,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:899:28 + --> $DIR/lint-unused-unsafe.rs:894:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1453,7 +1453,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:900:28 + --> $DIR/lint-unused-unsafe.rs:895:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1462,7 +1462,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:911:32 + --> $DIR/lint-unused-unsafe.rs:906:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1471,13 +1471,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:909:24 + --> $DIR/lint-unused-unsafe.rs:904:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:912:32 + --> $DIR/lint-unused-unsafe.rs:907:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1486,7 +1486,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:913:32 + --> $DIR/lint-unused-unsafe.rs:908:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1495,37 +1495,37 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:923:24 + --> $DIR/lint-unused-unsafe.rs:918:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:933:24 + --> $DIR/lint-unused-unsafe.rs:928:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:934:28 + --> $DIR/lint-unused-unsafe.rs:929:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:935:28 + --> $DIR/lint-unused-unsafe.rs:930:28 | LL | let _ = || unsafe {}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:941:24 + --> $DIR/lint-unused-unsafe.rs:936:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:942:28 + --> $DIR/lint-unused-unsafe.rs:937:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1535,13 +1535,13 @@ LL | let _ = || unsafe { unsf() }; | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:939:17 + --> $DIR/lint-unused-unsafe.rs:934:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:943:28 + --> $DIR/lint-unused-unsafe.rs:938:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1552,7 +1552,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:944:28 + --> $DIR/lint-unused-unsafe.rs:939:28 | LL | unsafe fn granularity_2() { | ------------------------- because it's nested under this `unsafe` fn @@ -1563,7 +1563,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:950:24 + --> $DIR/lint-unused-unsafe.rs:945:24 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1572,13 +1572,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:948:17 + --> $DIR/lint-unused-unsafe.rs:943:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:952:28 + --> $DIR/lint-unused-unsafe.rs:947:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1589,7 +1589,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:953:28 + --> $DIR/lint-unused-unsafe.rs:948:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1600,7 +1600,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:954:28 + --> $DIR/lint-unused-unsafe.rs:949:28 | LL | unsafe fn top_level_used_2() { | ---------------------------- because it's nested under this `unsafe` fn @@ -1611,7 +1611,7 @@ LL | let _ = || unsafe { unsf() }; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:965:32 + --> $DIR/lint-unused-unsafe.rs:960:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1620,13 +1620,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block | note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:963:24 + --> $DIR/lint-unused-unsafe.rs:958:24 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:966:32 + --> $DIR/lint-unused-unsafe.rs:961:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1635,7 +1635,7 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:967:32 + --> $DIR/lint-unused-unsafe.rs:962:32 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1644,13 +1644,13 @@ LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:987:24 + --> $DIR/lint-unused-unsafe.rs:982:24 | LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:999:24 + --> $DIR/lint-unused-unsafe.rs:994:24 | LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { | ----------------------------------------------- because it's nested under this `unsafe` fn @@ -1659,13 +1659,13 @@ LL | let _ = || unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:997:17 + --> $DIR/lint-unused-unsafe.rs:992:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1013:28 + --> $DIR/lint-unused-unsafe.rs:1008:28 | LL | let _ = || unsafe { | ------ because it's nested under this `unsafe` block @@ -1673,7 +1673,7 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1044:9 + --> $DIR/lint-unused-unsafe.rs:1039:9 | LL | unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() { | -------------------------------------------------- because it's nested under this `unsafe` fn @@ -1682,19 +1682,19 @@ LL | unsafe { | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:1045:21 + --> $DIR/lint-unused-unsafe.rs:1040:21 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1059:29 + --> $DIR/lint-unused-unsafe.rs:1054:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1066:33 + --> $DIR/lint-unused-unsafe.rs:1061:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1703,7 +1703,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1067:33 + --> $DIR/lint-unused-unsafe.rs:1062:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1712,7 +1712,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1068:33 + --> $DIR/lint-unused-unsafe.rs:1063:33 | LL | let _ = async { unsafe { | ------ because it's nested under this `unsafe` block @@ -1721,13 +1721,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1073:29 + --> $DIR/lint-unused-unsafe.rs:1068:29 | LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1074:33 + --> $DIR/lint-unused-unsafe.rs:1069:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1737,13 +1737,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:1071:17 + --> $DIR/lint-unused-unsafe.rs:1066:17 | LL | #[allow(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1075:33 + --> $DIR/lint-unused-unsafe.rs:1070:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1754,7 +1754,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1076:33 + --> $DIR/lint-unused-unsafe.rs:1071:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1765,7 +1765,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1078:29 + --> $DIR/lint-unused-unsafe.rs:1073:29 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1776,7 +1776,7 @@ LL | let _ = async { unsafe { = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1080:33 + --> $DIR/lint-unused-unsafe.rs:1075:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1787,7 +1787,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1081:33 + --> $DIR/lint-unused-unsafe.rs:1076:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1798,7 +1798,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1082:33 + --> $DIR/lint-unused-unsafe.rs:1077:33 | LL | async unsafe fn async_blocks() { | ------------------------------ because it's nested under this `unsafe` fn @@ -1809,13 +1809,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }}; = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 + --> $DIR/lint-unused-unsafe.rs:1087:22 | LL | let _x: [(); unsafe { 0 }] = []; | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1096:22 + --> $DIR/lint-unused-unsafe.rs:1091:22 | LL | let _x: [(); unsafe { unsafe { size() } }] = []; | ^^^^^^ unnecessary `unsafe` block diff --git a/src/test/ui/span/lint-unused-unsafe.rs b/src/test/ui/span/lint-unused-unsafe.rs index f8d1dff3572be..10a929a1689dd 100644 --- a/src/test/ui/span/lint-unused-unsafe.rs +++ b/src/test/ui/span/lint-unused-unsafe.rs @@ -2,13 +2,8 @@ // edition:2018 - -// revisions: mir - -// FIXME: Adapt -Zthir-unsafeck to behave the same as the mir version after #93678, -// then delete lint-unused-unsafe-thir.rs, and go back to using the settings below -// // revisions: mir thir -// // [thir]compile-flags: -Zthir-unsafeck +// revisions: mir thir +// [thir]compile-flags: -Zthir-unsafeck #![allow(dead_code)] #![deny(unused_unsafe)] diff --git a/src/test/ui/span/lint-unused-unsafe.thir.stderr b/src/test/ui/span/lint-unused-unsafe.thir.stderr new file mode 100644 index 0000000000000..0bf39edb75dfa --- /dev/null +++ b/src/test/ui/span/lint-unused-unsafe.thir.stderr @@ -0,0 +1,1824 @@ +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1054:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:9:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1061:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1062:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1063:33 + | +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1068:29 + | +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1069:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:1066:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1070:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1071:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1073:29 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1075:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1076:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1077:33 + | +LL | async unsafe fn async_blocks() { + | ------------------------------ because it's nested under this `unsafe` fn +... +LL | let _ = async { unsafe { let _ = async { unsf() }; }}; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1091:22 + | +LL | let _x: [(); unsafe { unsafe { size() } }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:21:13 + | +LL | fn bad1() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:22:13 + | +LL | fn bad2() { unsafe { bad1() } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:23:20 + | +LL | unsafe fn bad3() { unsafe {} } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:24:13 + | +LL | fn bad4() { unsafe { callback(||{}) } } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:25:20 + | +LL | unsafe fn bad5() { unsafe { unsf() } } + | ---------------- ^^^^^^ unnecessary `unsafe` block + | | + | because it's nested under this `unsafe` fn + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + = note: `#[allow(unsafe_op_in_unsafe_fn)]` on by default + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:27:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:34:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:35:9 + | +LL | unsafe fn bad7() { + | ---------------- because it's nested under this `unsafe` fn +LL | unsafe { +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:69:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:78:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:79:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:80:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:85:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:95:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:96:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:97:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:107:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:105:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:108:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:109:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:119:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:129:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:130:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:131:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:137:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:148:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:149:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:150:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:161:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:159:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:162:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:163:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:173:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:183:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:184:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:185:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:191:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:192:13 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +LL | unsafe { +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:189:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:193:13 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:194:13 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:200:9 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:198:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:202:13 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:203:13 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:204:13 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:215:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:213:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:216:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:217:17 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe { unsf() } + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:237:9 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:249:9 + | +LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { + | ----------------------------------------------- because it's nested under this `unsafe` fn +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:247:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:263:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:281:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:290:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:291:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:292:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:297:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:307:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:308:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:309:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:319:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:317:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:320:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:321:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:331:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:341:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:342:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:343:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:349:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:360:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:361:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:362:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:373:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:371:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:374:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:375:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:385:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:395:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:396:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:397:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:403:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:404:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:401:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:405:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:406:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:412:20 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:410:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:414:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:415:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:416:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:427:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:425:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:428:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:429:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:449:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:461:20 + | +LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { + | ----------------------------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:459:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:475:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:494:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:503:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:504:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:505:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:510:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:520:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:521:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:522:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:532:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:530:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:533:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:534:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:544:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:554:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:555:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:556:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:562:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:573:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:574:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:575:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:586:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:584:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:587:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:588:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:598:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:608:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:609:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:610:24 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:616:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:617:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:614:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:618:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:619:24 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:625:20 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:623:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:627:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:628:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:629:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:640:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:638:20 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:641:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:642:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { let _ = || unsf(); }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:662:20 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:674:20 + | +LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { + | ----------------------------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:672:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:688:24 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:706:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:716:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:717:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:718:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:724:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:735:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:736:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:737:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:748:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:746:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:749:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:750:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:760:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:770:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:771:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:772:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:778:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:779:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:776:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:780:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:781:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:787:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:785:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:789:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:790:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:791:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:802:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:800:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:803:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:804:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:824:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:836:24 + | +LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { + | ----------------------------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:834:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:850:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:864:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:874:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:875:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:876:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:882:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:893:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:894:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:895:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:906:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:904:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:907:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:908:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:918:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:928:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:929:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:930:28 + | +LL | let _ = || unsafe {}; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:936:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:937:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:934:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:938:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:939:28 + | +LL | unsafe fn granularity_2() { + | ------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:945:24 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:943:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:947:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:948:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:949:28 + | +LL | unsafe fn top_level_used_2() { + | ---------------------------- because it's nested under this `unsafe` fn +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:960:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:958:24 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:961:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:962:32 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | let _ = || unsafe { unsf() }; + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:982:24 + | +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:994:24 + | +LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { + | ----------------------------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:992:17 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1008:28 + | +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1039:9 + | +LL | unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() { + | -------------------------------------------------- because it's nested under this `unsafe` fn +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/lint-unused-unsafe.rs:1040:21 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/lint-unused-unsafe.rs:1087:22 + | +LL | let _x: [(); unsafe { 0 }] = []; + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 201 previous errors + diff --git a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr index 2ba6a72930df8..d74252123a165 100644 --- a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr +++ b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr @@ -76,12 +76,10 @@ LL | unsafe {} | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:14 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5 | LL | unsafe { unsafe { unsf() } } - | ------ ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:60:5 @@ -91,6 +89,13 @@ LL | unsafe fn allow_level() { ... LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:53:9 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ error: unnecessary `unsafe` block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:72:9 @@ -100,6 +105,13 @@ LL | unsafe fn nested_allow_level() { ... LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block + | + = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` +note: the lint level is defined here + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:65:13 + | +LL | #[allow(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:78:5