From e9a5694597a3dc480827abf6fb5b8c9e48801471 Mon Sep 17 00:00:00 2001 From: Elliot Bobrow Date: Sat, 3 Jul 2021 09:34:10 -0700 Subject: [PATCH] fix doc_markdown false positive --- clippy_lints/src/doc.rs | 2 +- tests/ui/doc/unbalanced_ticks.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 4e164d33a05..17d868f1ec8 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -549,7 +549,7 @@ fn check_doc<'a, Events: Iterator, Range { let (begin, span) = get_current_span(spans, range.start); paragraph_span = paragraph_span.with_hi(span.hi()); - ticks_unbalanced |= text.contains('`'); + ticks_unbalanced |= text.contains('`') && !in_code; if Some(&text) == in_link.as_ref() || ticks_unbalanced { // Probably a link of the form `` // Which are represented as a link to "http://example.com" with diff --git a/tests/ui/doc/unbalanced_ticks.rs b/tests/ui/doc/unbalanced_ticks.rs index 78e87bc6906..8e8324b30f0 100644 --- a/tests/ui/doc/unbalanced_ticks.rs +++ b/tests/ui/doc/unbalanced_ticks.rs @@ -34,3 +34,10 @@ fn in_code_block() {} /// - This `item has unbalanced tick marks /// - This item needs backticks_here fn other_markdown() {} + +#[rustfmt::skip] +/// - ```rust +/// /// `lol` +/// pub struct Struct; +/// ``` +fn iss_7421() {}