mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Fix false positive with DOC_MARKDOWN and links
This commit is contained in:
+7
-2
@@ -69,7 +69,7 @@ fn doc_and_span(attr: &ast::Attribute) -> Option<(&str, Span)> {
|
||||
let (doc, span) = doc_attrs.next().unwrap_or_else(|| unreachable!());
|
||||
(doc.into(), Some(span))
|
||||
}
|
||||
_ => (doc_attrs.map(|s| s.0).collect::<String>().into(), None),
|
||||
_ => (doc_attrs.map(|s| format!("{}\n", s.0)).collect::<String>().into(), None),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,9 +124,14 @@ fn has_underscore(s: &str) -> bool {
|
||||
s != "_" && !s.contains("\\_") && s.contains('_')
|
||||
}
|
||||
|
||||
// Something with a `/` might be a link, don’t warn (see #823):
|
||||
if word.contains('/') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Trim punctuation as in `some comment (see foo::bar).`
|
||||
// ^^
|
||||
// Or even as `_foo bar_` which is emphasized.
|
||||
// Or even as in `_foo bar_` which is emphasized.
|
||||
let word = word.trim_matches(|c: char| !c.is_alphanumeric());
|
||||
|
||||
if has_underscore(word) || word.contains("::") || is_camel_case(word) {
|
||||
|
||||
@@ -29,6 +29,11 @@ fn multiline_ticks() {
|
||||
fn test_emphasis() {
|
||||
}
|
||||
|
||||
/// This test has [a link with underscores][chunked-example] inside it. See #823.
|
||||
/// See also [the issue tracker](https://github.com/Manishearth/rust-clippy/search?q=doc_markdown&type=Issues).
|
||||
///
|
||||
/// [chunked-example]: http://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
|
||||
|
||||
/// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
|
||||
/// `multiline_ticks` functions.
|
||||
fn main() {
|
||||
|
||||
Reference in New Issue
Block a user