Skip to content

Commit edca730

Browse files
Fix false positive for missing_backticks in footnote references
1 parent 8f3cfb4 commit edca730

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

clippy_lints/src/doc/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
768768
);
769769
}
770770
},
771-
FootnoteReference(text) | Text(text) => {
771+
Text(text) => {
772772
paragraph_range.end = range.end;
773773
let range_ = range.clone();
774774
ticks_unbalanced |= text.contains('`')
@@ -812,7 +812,8 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
812812
}
813813
text_to_check.push((text, range, code_level));
814814
}
815-
},
815+
}
816+
FootnoteReference(_) => {}
816817
}
817818
}
818819
headers

tests/ui/doc/footnote_issue_13183.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This is a regression test for <https://github.com/rust-lang/rust-clippy/issues/13183>.
2+
// It should not warn on missing backticks on footnote references.
3+
4+
#![warn(clippy::doc_markdown)]
5+
// Should not warn!
6+
//! Here's a footnote[^example_footnote_identifier]
7+
//!
8+
//! [^example_footnote_identifier]: This is merely an example.
9+
10+
fn main() {}

0 commit comments

Comments
 (0)