Skip to content

Commit e245f7c

Browse files
committed
Auto merge of rust-lang#11735 - rust-lang:fix-11568, r=blyxyas
ignore lower-camel-case words in `doc_markdown` This fixes rust-lang#11568 by ignoring camelCase words starting with a lower case letter. r? `@blyxyas` --- changelog: none
2 parents 739f9e2 + e6c804c commit e245f7c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

clippy_lints/src/doc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,12 @@ fn check_text(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, text: &str
756756
}
757757

758758
fn check_word(cx: &LateContext<'_>, word: &str, span: Span) {
759-
/// Checks if a string is camel-case, i.e., contains at least two uppercase
760-
/// letters (`Clippy` is ok) and one lower-case letter (`NASA` is ok).
759+
/// Checks if a string is upper-camel-case, i.e., starts with an uppercase and
760+
/// contains at least two uppercase letters (`Clippy` is ok) and one lower-case
761+
/// letter (`NASA` is ok).
761762
/// Plurals are also excluded (`IDs` is ok).
762763
fn is_camel_case(s: &str) -> bool {
763-
if s.starts_with(|c: char| c.is_ascii_digit()) {
764+
if s.starts_with(|c: char| c.is_ascii_digit() | c.is_ascii_lowercase()) {
764765
return false;
765766
}
766767

tests/ui/doc/doc-fixable.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: {
224224
}
225225
}
226226
}
227+
228+
/// this checks if the lowerCamelCase issue is fixed
229+
fn issue_11568() {}

tests/ui/doc/doc-fixable.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: {
224224
}
225225
}
226226
}
227+
228+
/// this checks if the lowerCamelCase issue is fixed
229+
fn issue_11568() {}

0 commit comments

Comments
 (0)