Auto merge of #13195 - GuillaumeGomez:fix-false-positive-13183, r=Manishearth

Fix false positive for `missing_backticks` in footnote references

Fixes #13183.

changelog: Fix false positive for `missing_backticks` in footnote references
This commit is contained in:
bors 2024-07-31 16:06:27 +00:00
commit 5542309895
2 changed files with 13 additions and 2 deletions

View file

@ -768,7 +768,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
); );
} }
}, },
FootnoteReference(text) | Text(text) => { Text(text) => {
paragraph_range.end = range.end; paragraph_range.end = range.end;
let range_ = range.clone(); let range_ = range.clone();
ticks_unbalanced |= text.contains('`') ticks_unbalanced |= text.contains('`')
@ -812,7 +812,8 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
} }
text_to_check.push((text, range, code_level)); text_to_check.push((text, range, code_level));
} }
}, }
FootnoteReference(_) => {}
} }
} }
headers headers

View file

@ -0,0 +1,10 @@
// This is a regression test for <https://github.com/rust-lang/rust-clippy/issues/13183>.
// It should not warn on missing backticks on footnote references.
#![warn(clippy::doc_markdown)]
// Should not warn!
//! Here's a footnote[^example_footnote_identifier]
//!
//! [^example_footnote_identifier]: This is merely an example.
fn main() {}