Skip to content

Commit

Permalink
ignore lower-camel-case words in doc_markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
llogiq committed Oct 29, 2023
1 parent fa6fd8c commit e6c804c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/ui/doc/doc-fixable.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: {
}
}
}

/// this checks if the lowerCamelCase issue is fixed
fn issue_11568() {}
3 changes: 3 additions & 0 deletions tests/ui/doc/doc-fixable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ where [(); N.checked_next_power_of_two().unwrap()]: {
}
}
}

/// this checks if the lowerCamelCase issue is fixed
fn issue_11568() {}

0 comments on commit e6c804c

Please sign in to comment.