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
This commit is contained in:
bors 2023-10-30 12:06:58 +00:00
commit e245f7c29f
3 changed files with 10 additions and 3 deletions

View File

@ -756,11 +756,12 @@ fn check_text(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, text: &str
} }
fn check_word(cx: &LateContext<'_>, word: &str, span: Span) { fn check_word(cx: &LateContext<'_>, word: &str, span: Span) {
/// Checks if a string is camel-case, i.e., contains at least two uppercase /// Checks if a string is upper-camel-case, i.e., starts with an uppercase and
/// letters (`Clippy` is ok) and one lower-case letter (`NASA` is ok). /// contains at least two uppercase letters (`Clippy` is ok) and one lower-case
/// letter (`NASA` is ok).
/// Plurals are also excluded (`IDs` is ok). /// Plurals are also excluded (`IDs` is ok).
fn is_camel_case(s: &str) -> bool { 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; return false;
} }

View File

@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: {
} }
} }
} }
/// this checks if the lowerCamelCase issue is fixed
fn issue_11568() {}

View File

@ -224,3 +224,6 @@ fn new() -> Self {
} }
} }
} }
/// this checks if the lowerCamelCase issue is fixed
fn issue_11568() {}