Correctly handle closing parens in missing_backticks doc lint

This commit is contained in:
Guillaume Gomez 2024-05-16 16:24:58 +02:00
parent 0b1bf37722
commit 4f98cc6d55
4 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#![warn(clippy::doc_markdown)]
//! A comment with `a_b(x)` and `a_c` in it and (`a_b((c))` ) too and (maybe `a_b((c))`)
//~^ ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
pub fn main() {}

View file

@ -0,0 +1,9 @@
#![warn(clippy::doc_markdown)]
//! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
//~^ ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
//~| ERROR: item in documentation is missing backticks
pub fn main() {}

View file

@ -0,0 +1,48 @@
error: item in documentation is missing backticks
--> tests/ui/doc/issue_12795.rs:3:20
|
LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
| ^^^^^^
|
= note: `-D clippy::doc-markdown` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
help: try
|
LL | //! A comment with `a_b(x)` and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
| ~~~~~~~~
error: item in documentation is missing backticks
--> tests/ui/doc/issue_12795.rs:3:31
|
LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
| ^^^
|
help: try
|
LL | //! A comment with a_b(x) and `a_c` in it and (a_b((c)) ) too and (maybe a_b((c)))
| ~~~~~
error: item in documentation is missing backticks
--> tests/ui/doc/issue_12795.rs:3:46
|
LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
| ^^^^^^^^
|
help: try
|
LL | //! A comment with a_b(x) and a_c in it and (`a_b((c))` ) too and (maybe a_b((c)))
| ~~~~~~~~~~
error: item in documentation is missing backticks
--> tests/ui/doc/issue_12795.rs:3:72
|
LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
| ^^^^^^^^
|
help: try
|
LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe `a_b((c))`)
| ~~~~~~~~~~
error: aborting due to 4 previous errors