Skip to content

Commit

Permalink
Auto merge of rust-lang#5023 - rust-lang:doc-main, r=phansch
Browse files Browse the repository at this point in the history
Omit doc safety/errors header checking for main

This omits checking `main` methods, which are not usually documented in the way the others are.

changelog: none
  • Loading branch information
bors committed Jan 14, 2020
2 parents c24a422 + 2797b64 commit 5ab50d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{match_type, paths, return_ty, span_lint};
use crate::utils::{is_entrypoint_fn, match_type, paths, return_ty, span_lint};
use itertools::Itertools;
use rustc::lint::in_external_macro;
use rustc_data_structures::fx::FxHashSet;
Expand Down Expand Up @@ -153,7 +153,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
match item.kind {
hir::ItemKind::Fn(ref sig, ..) => {
if !in_external_macro(cx.tcx.sess, item.span) {
if !(is_entrypoint_fn(cx, cx.tcx.hir().local_def_id(item.hir_id))
|| in_external_macro(cx.tcx.sess, item.span))
{
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
}
},
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/doc_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ impl Trait1 for Struct1 {
}
}

fn main() {}
fn main() -> Result<(), ()> {
Ok(())
}

0 comments on commit 5ab50d2

Please sign in to comment.