mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-27 14:24:08 +00:00
Auto merge of #3510 - phansch:fix_doc_markdown_mixed_case, r=flip1995
Fix doc_markdown mixed case false positive Fixes #2343
This commit is contained in:
commit
777c9099e7
@ -281,6 +281,10 @@ fn check_word(cx: &EarlyContext<'_>, word: &str, span: Span) {
|
|||||||
s != "_" && !s.contains("\\_") && s.contains('_')
|
s != "_" && !s.contains("\\_") && s.contains('_')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_hyphen(s: &str) -> bool {
|
||||||
|
s != "-" && s.contains('-')
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(url) = Url::parse(word) {
|
if let Ok(url) = Url::parse(word) {
|
||||||
// try to get around the fact that `foo::bar` parses as a valid URL
|
// try to get around the fact that `foo::bar` parses as a valid URL
|
||||||
if !url.cannot_be_a_base() {
|
if !url.cannot_be_a_base() {
|
||||||
@ -295,6 +299,11 @@ fn check_word(cx: &EarlyContext<'_>, word: &str, span: Span) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We assume that mixed-case words are not meant to be put inside bacticks. (Issue #2343)
|
||||||
|
if has_underscore(word) && has_hyphen(word) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if has_underscore(word) || word.contains("::") || is_camel_case(word) {
|
if has_underscore(word) || word.contains("::") || is_camel_case(word) {
|
||||||
span_lint(
|
span_lint(
|
||||||
cx,
|
cx,
|
||||||
|
@ -181,3 +181,7 @@ fn issue_2395() {}
|
|||||||
/// An iterator over mycrate::Collection's values.
|
/// An iterator over mycrate::Collection's values.
|
||||||
/// It should not lint a `'static` lifetime in ticks.
|
/// It should not lint a `'static` lifetime in ticks.
|
||||||
fn issue_2210() {}
|
fn issue_2210() {}
|
||||||
|
|
||||||
|
/// This should not cause the lint to trigger:
|
||||||
|
/// #REQ-data-family.lint_partof_exists
|
||||||
|
fn issue_2343() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user