Skip to content

Commit 5ab50d2

Browse files
committed
Auto merge of rust-lang#5023 - rust-lang:doc-main, r=phansch
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
2 parents c24a422 + 2797b64 commit 5ab50d2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

clippy_lints/src/doc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{match_type, paths, return_ty, span_lint};
1+
use crate::utils::{is_entrypoint_fn, match_type, paths, return_ty, span_lint};
22
use itertools::Itertools;
33
use rustc::lint::in_external_macro;
44
use rustc_data_structures::fx::FxHashSet;
@@ -153,7 +153,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
153153
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
154154
match item.kind {
155155
hir::ItemKind::Fn(ref sig, ..) => {
156-
if !in_external_macro(cx.tcx.sess, item.span) {
156+
if !(is_entrypoint_fn(cx, cx.tcx.hir().local_def_id(item.hir_id))
157+
|| in_external_macro(cx.tcx.sess, item.span))
158+
{
157159
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
158160
}
159161
},

tests/ui/doc_errors.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ impl Trait1 for Struct1 {
6161
}
6262
}
6363

64-
fn main() {}
64+
fn main() -> Result<(), ()> {
65+
Ok(())
66+
}

0 commit comments

Comments
 (0)