From 1ffaac1a69d3a858938c85894044f8fa50805bd1 Mon Sep 17 00:00:00 2001 From: Serial Date: Mon, 4 Oct 2021 19:33:14 -0400 Subject: [PATCH] Fix if_chain --- .../src/undocumented_unsafe_blocks.rs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) 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); } } }