diff options
| author | bors <bors@rust-lang.org> | 2023-10-30 12:06:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-30 12:06:58 +0000 |
| commit | e245f7c29f532afe12df111c4b35c5d238065282 (patch) | |
| tree | d6a19c05f9dd000915bcd21065928d580cbc1c48 | |
| parent | 739f9e2503ca1d608fc968586e0a35dd63c2823e (diff) | |
| parent | e6c804c457ba20d65d3aac2e21c0e534ad479237 (diff) | |
| download | rust-e245f7c29f532afe12df111c4b35c5d238065282.tar.gz rust-e245f7c29f532afe12df111c4b35c5d238065282.zip | |
Auto merge of #11735 - rust-lang:fix-11568, r=blyxyas
ignore lower-camel-case words in `doc_markdown` This fixes #11568 by ignoring camelCase words starting with a lower case letter. r? `@blyxyas` --- changelog: none
| -rw-r--r-- | clippy_lints/src/doc.rs | 7 | ||||
| -rw-r--r-- | tests/ui/doc/doc-fixable.fixed | 3 | ||||
| -rw-r--r-- | tests/ui/doc/doc-fixable.rs | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index a2e05e5ba8d..e2f595dcf18 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -756,11 +756,12 @@ fn check_text(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, text: &str } fn check_word(cx: &LateContext<'_>, word: &str, span: Span) { - /// Checks if a string is camel-case, i.e., contains at least two uppercase - /// letters (`Clippy` is ok) and one lower-case letter (`NASA` is ok). + /// Checks if a string is upper-camel-case, i.e., starts with an uppercase and + /// contains at least two uppercase letters (`Clippy` is ok) and one lower-case + /// letter (`NASA` is ok). /// Plurals are also excluded (`IDs` is ok). fn is_camel_case(s: &str) -> bool { - if s.starts_with(|c: char| c.is_ascii_digit()) { + if s.starts_with(|c: char| c.is_ascii_digit() | c.is_ascii_lowercase()) { return false; } diff --git a/tests/ui/doc/doc-fixable.fixed b/tests/ui/doc/doc-fixable.fixed index 47b56960a00..aee89719728 100644 --- a/tests/ui/doc/doc-fixable.fixed +++ b/tests/ui/doc/doc-fixable.fixed @@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: { } } } + +/// this checks if the lowerCamelCase issue is fixed +fn issue_11568() {} diff --git a/tests/ui/doc/doc-fixable.rs b/tests/ui/doc/doc-fixable.rs index 4d9a4eafa5f..b6346b881ad 100644 --- a/tests/ui/doc/doc-fixable.rs +++ b/tests/ui/doc/doc-fixable.rs @@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: { } } } + +/// this checks if the lowerCamelCase issue is fixed +fn issue_11568() {} |
