Skip to content

Commit c195db7

Browse files
committed
Auto merge of #7426 - ebobrow:doc-markdown-fp, r=llogiq
fix doc_markdown false positive fixes #7421 changelog: don't lint unbalanced tick marks in code blocks
2 parents 8420999 + e9a5694 commit c195db7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
549549
FootnoteReference(text) | Text(text) => {
550550
let (begin, span) = get_current_span(spans, range.start);
551551
paragraph_span = paragraph_span.with_hi(span.hi());
552-
ticks_unbalanced |= text.contains('`');
552+
ticks_unbalanced |= text.contains('`') && !in_code;
553553
if Some(&text) == in_link.as_ref() || ticks_unbalanced {
554554
// Probably a link of the form `<http://example.com>`
555555
// Which are represented as a link to "http://example.com" with

tests/ui/doc/unbalanced_ticks.rs

+7
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ fn in_code_block() {}
3434
/// - This `item has unbalanced tick marks
3535
/// - This item needs backticks_here
3636
fn other_markdown() {}
37+
38+
#[rustfmt::skip]
39+
/// - ```rust
40+
/// /// `lol`
41+
/// pub struct Struct;
42+
/// ```
43+
fn iss_7421() {}

0 commit comments

Comments
 (0)