diff --git a/clippy_lints/src/undocumented_unsafe_blocks.rs b/clippy_lints/src/undocumented_unsafe_blocks.rs index a1a98b194230..f8be71704c09 100644 --- a/clippy_lints/src/undocumented_unsafe_blocks.rs +++ b/clippy_lints/src/undocumented_unsafe_blocks.rs @@ -61,23 +61,22 @@ impl LateLintPass<'_> for UndocumentedUnsafeBlocks { if !in_external_macro(cx.tcx.sess, block.span); if let BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided) = block.rules; if let Some(enclosing_scope_hir_id) = cx.tcx.hir().get_enclosing_scope(block.hir_id); + if block_has_safety_comment(cx.tcx, enclosing_scope_hir_id, block.span) == Some(false); then { - if block_has_safety_comment(cx.tcx, enclosing_scope_hir_id, block.span) == Some(false) { - let mut span = block.span; + let mut span = block.span; - if let Some(local_span) = self.local_span { - span = local_span; + if let Some(local_span) = self.local_span { + span = local_span; - let result = block_has_safety_comment(cx.tcx, enclosing_scope_hir_id, span); + let result = block_has_safety_comment(cx.tcx, enclosing_scope_hir_id, span); - if result == Some(true) || result.is_none() { - self.local_checked = true; - return; - } + if result == Some(true) || result.is_none() { + self.local_checked = true; + return; } - - err(cx, span); } + + err(cx, span); } } }