Skip to content

Commit c8b0923

Browse files
committed
Auto merge of rust-lang#13163 - GuillaumeGomez:fix-13097, r=Alexendoo
Fix case where doc_markdown is triggered on words ending with "ified" Fixes rust-lang#13097. r? `@Alexendoo` changelog: Fix case where doc_markdown is triggered on words ending with "ified"
2 parents 37f98ff + 88506a9 commit c8b0923

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

clippy_lints/src/doc/markdown.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ fn check_word(cx: &LateContext<'_>, word: &str, span: Span, code_level: isize, b
9292
&& matches!(prefix.chars().last(), Some('S' | 'X'))
9393
{
9494
prefix
95+
} else if let Some(prefix) = s.strip_suffix("ified")
96+
&& prefix.chars().all(|c| c.is_ascii_uppercase())
97+
{
98+
prefix
9599
} else {
96100
s.strip_suffix('s').unwrap_or(s)
97101
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This test checks that words starting with capital letters and ending with "ified" don't
2+
// trigger the lint.
3+
4+
#![deny(clippy::doc_markdown)]
5+
6+
pub enum OutputFormat {
7+
/// `HumaNified`
8+
//~^ ERROR: item in documentation is missing backticks
9+
Plain,
10+
// Should not warn!
11+
/// JSONified console output
12+
Json,
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This test checks that words starting with capital letters and ending with "ified" don't
2+
// trigger the lint.
3+
4+
#![deny(clippy::doc_markdown)]
5+
6+
pub enum OutputFormat {
7+
/// HumaNified
8+
//~^ ERROR: item in documentation is missing backticks
9+
Plain,
10+
// Should not warn!
11+
/// JSONified console output
12+
Json,
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: item in documentation is missing backticks
2+
--> tests/ui/doc/doc_markdown-issue_13097.rs:7:9
3+
|
4+
LL | /// HumaNified
5+
| ^^^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> tests/ui/doc/doc_markdown-issue_13097.rs:4:9
9+
|
10+
LL | #![deny(clippy::doc_markdown)]
11+
| ^^^^^^^^^^^^^^^^^^^^
12+
help: try
13+
|
14+
LL | /// `HumaNified`
15+
| ~~~~~~~~~~~~
16+
17+
error: aborting due to 1 previous error
18+

0 commit comments

Comments
 (0)