diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-07-31 17:20:02 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-07-31 17:27:53 +0200 |
| commit | edca73003beff32bfb7de2c39b6b00c2436c4d04 (patch) | |
| tree | 471434e91b3b40e2cbca70568405bae247002565 | |
| parent | 8f3cfb4974898c5575f4fc7d029798657bb47368 (diff) | |
| download | rust-edca73003beff32bfb7de2c39b6b00c2436c4d04.tar.gz rust-edca73003beff32bfb7de2c39b6b00c2436c4d04.zip | |
Fix false positive for `missing_backticks` in footnote references
| -rw-r--r-- | clippy_lints/src/doc/mod.rs | 5 | ||||
| -rw-r--r-- | tests/ui/doc/footnote_issue_13183.rs | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs index 5b6a5b08aa9..7adffb09eb5 100644 --- a/clippy_lints/src/doc/mod.rs +++ b/clippy_lints/src/doc/mod.rs @@ -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; let range_ = range.clone(); 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)); } - }, + } + FootnoteReference(_) => {} } } headers diff --git a/tests/ui/doc/footnote_issue_13183.rs b/tests/ui/doc/footnote_issue_13183.rs new file mode 100644 index 00000000000..a18b4c3ac53 --- /dev/null +++ b/tests/ui/doc/footnote_issue_13183.rs @@ -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() {} |
