From 9881b158221835e894e5e79d44b695e964a6e41b Mon Sep 17 00:00:00 2001 From: mcarton Date: Tue, 30 May 2017 19:50:07 +0200 Subject: [PATCH] Ignore mix of {,non-}sugared doc in `doc_markdown` --- clippy_lints/src/doc.rs | 5 +++++ clippy_tests/examples/doc.rs | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index ff502819ffc5f..49fdb39a3805c 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -126,6 +126,11 @@ pub fn check_attrs<'a>(cx: &EarlyContext, valid_idents: &[String], attrs: &'a [a spans.extend_from_slice(¤t_spans); doc.push_str(¤t); } + } else if let Some(name) = attr.name() { + // ignore mix of sugared and non-sugared doc + if name == "doc" { + return; + } } } diff --git a/clippy_tests/examples/doc.rs b/clippy_tests/examples/doc.rs index 15a2a7646bafb..0be34aa6f53a2 100644 --- a/clippy_tests/examples/doc.rs +++ b/clippy_tests/examples/doc.rs @@ -144,3 +144,12 @@ fn four_quotes() { /// [NIST SP 800-56A, revision 2]: /// https://github.com/Manishearth/rust-clippy/issues/902#issuecomment-261919419 fn issue_902_comment() {} + +#[cfg_attr(feature = "a", doc = " ```")] +#[cfg_attr(not(feature = "a"), doc = " ```ignore")] +/// fn main() { +/// let s = "localhost:10000".to_string(); +/// println!("{}", s); +/// } +/// ``` +fn issue_1469() {}