diff options
| author | bors <bors@rust-lang.org> | 2020-01-14 21:21:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-14 21:21:58 +0000 |
| commit | 5ab50d20a6d624c28f40d87eaccfbf9cfbfdd478 (patch) | |
| tree | 873a4cdef861a5278bed714377b0586931625a18 | |
| parent | c24a42289b50cb6bacb697b90aac2bbe747cdd97 (diff) | |
| parent | 2797b64f7ecd80c0d44167ac9ff2ce1167fe472f (diff) | |
| download | rust-5ab50d20a6d624c28f40d87eaccfbf9cfbfdd478.tar.gz rust-5ab50d20a6d624c28f40d87eaccfbf9cfbfdd478.zip | |
Auto merge of #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
| -rw-r--r-- | clippy_lints/src/doc.rs | 6 | ||||
| -rw-r--r-- | tests/ui/doc_errors.rs | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 9a349611b3d..dd09499c0ce 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -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; @@ -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); } }, diff --git a/tests/ui/doc_errors.rs b/tests/ui/doc_errors.rs index 408cf573896..776a65275e9 100644 --- a/tests/ui/doc_errors.rs +++ b/tests/ui/doc_errors.rs @@ -61,4 +61,6 @@ impl Trait1 for Struct1 { } } -fn main() {} +fn main() -> Result<(), ()> { + Ok(()) +} |
