Handle plural acronyms in doc_markdown
This commit is contained in:
parent
5214ab557f
commit
cc4c8db0fd
@ -60,7 +60,14 @@ fn is_camel_case(s: &str) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
let s = s.strip_suffix('s').unwrap_or(s);
|
||||
let s = if let Some(prefix) = s.strip_suffix("es")
|
||||
&& prefix.chars().all(|c| c.is_ascii_uppercase())
|
||||
&& matches!(prefix.chars().last(), Some('S' | 'X'))
|
||||
{
|
||||
prefix
|
||||
} else {
|
||||
s.strip_suffix('s').unwrap_or(s)
|
||||
};
|
||||
|
||||
s.chars().all(char::is_alphanumeric)
|
||||
&& s.chars().filter(|&c| c.is_uppercase()).take(2).count() > 1
|
||||
|
@ -230,3 +230,8 @@ fn issue_11568() {}
|
||||
|
||||
/// There is no try (`do()` or `do_not()`).
|
||||
fn parenthesized_word() {}
|
||||
|
||||
/// `ABes`
|
||||
/// OSes
|
||||
/// UXes
|
||||
fn plural_acronym_test() {}
|
||||
|
@ -230,3 +230,8 @@ fn issue_11568() {}
|
||||
|
||||
/// There is no try (do() or do_not()).
|
||||
fn parenthesized_word() {}
|
||||
|
||||
/// ABes
|
||||
/// OSes
|
||||
/// UXes
|
||||
fn plural_acronym_test() {}
|
||||
|
@ -341,5 +341,16 @@ help: try
|
||||
LL | /// There is no try (do() or `do_not()`).
|
||||
| ~~~~~~~~~~
|
||||
|
||||
error: aborting due to 31 previous errors
|
||||
error: item in documentation is missing backticks
|
||||
--> tests/ui/doc/doc-fixable.rs:234:5
|
||||
|
|
||||
LL | /// ABes
|
||||
| ^^^^
|
||||
|
|
||||
help: try
|
||||
|
|
||||
LL | /// `ABes`
|
||||
| ~~~~~~
|
||||
|
||||
error: aborting due to 32 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user