about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/doc.rs2
-rw-r--r--tests/ui/doc/unbalanced_ticks.rs7
2 files changed, 8 insertions, 1 deletions
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<Item = (pulldown_cmark::Event<'a>, Range<usize
             FootnoteReference(text) | Text(text) => {
                 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 `<http://example.com>`
                     // 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() {}