mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Merge pull request #2349 from rust-lang-nursery/no-main-doc
Don't warn about missing docs for main()
This commit is contained in:
commit
2f62d803ab
2 changed files with 11 additions and 7 deletions
|
@ -124,7 +124,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
let desc = match it.node {
|
||||
hir::ItemConst(..) => "a constant",
|
||||
hir::ItemEnum(..) => "an enum",
|
||||
hir::ItemFn(..) => "a function",
|
||||
hir::ItemFn(..) => {
|
||||
// ignore main()
|
||||
if it.name == "main" {
|
||||
let def_id = cx.tcx.hir.local_def_id(it.id);
|
||||
let def_key = cx.tcx.hir.def_key(def_id);
|
||||
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
"a function"
|
||||
},
|
||||
hir::ItemMod(..) => "a module",
|
||||
hir::ItemStatic(..) => "a static",
|
||||
hir::ItemStruct(..) => "a struct",
|
||||
|
|
|
@ -264,9 +264,3 @@ error: missing documentation for a function
|
|||
191 | fn also_undocumented2() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/missing-doc.rs:202:1
|
||||
|
|
||||
202 | fn main() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Reference in a new issue