Accept unsugared docs in missing-doc lint

Closes #10853
This commit is contained in:
Steven Fackler 2013-12-08 18:41:24 -08:00
parent a6310f6ad3
commit 4d688e8214
2 changed files with 29 additions and 1 deletions

View File

@ -1074,7 +1074,13 @@ fn check_missing_doc_attrs(cx: &Context,
_ => ()
}
if !attrs.iter().any(|a| a.node.is_sugared_doc) {
let has_doc = attrs.iter().any(|a| {
match a.node.value.node {
ast::MetaNameValue(ref name, _) if "doc" == *name => true,
_ => false
}
});
if !has_doc {
cx.span_lint(missing_doc, sp,
format!("missing documentation for {}", desc));
}

View File

@ -0,0 +1,22 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[deny(missing_doc)];
#[doc="module"];
#[doc="struct"]
pub struct Foo;
pub fn foo() {
#[doc="fn"];
}
#[doc="main"]
pub fn main() {}