]> git.lizzy.rs Git - rust.git/commitdiff
Omit doc safety/errors header checking for main
authorAndre Bogus <bogusandre@gmail.com>
Tue, 14 Jan 2020 17:20:56 +0000 (18:20 +0100)
committerAndre Bogus <bogusandre@gmail.com>
Tue, 14 Jan 2020 17:20:56 +0000 (18:20 +0100)
clippy_lints/src/doc.rs
tests/ui/doc_errors.rs

index 9a349611b3d0505a3e1a02473a72b27f8b80b4cd..dd09499c0cebc989712214713c25fbae20f26330 100644 (file)
@@ -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 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>)
         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);
                 }
             },
index 408cf573896a7e7f793b55ec0e00ce5d038a56c5..776a65275e9baf27654ab771884514739cb30d49 100644 (file)
@@ -61,4 +61,6 @@ fn trait_method_with_errors_header() -> Result<(), ()> {
     }
 }
 
-fn main() {}
+fn main() -> Result<(), ()> {
+    Ok(())
+}