]> git.lizzy.rs Git - rust.git/commitdiff
Update to new diagnostic
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 12 Feb 2020 14:48:08 +0000 (15:48 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 22 Mar 2020 12:01:42 +0000 (13:01 +0100)
src/librustdoc/core.rs

index 116bb70dcf62f52039147ec3d4d6ba3271f14e39..4d2d81e48fc9e48f62c17e29c801d4ccdfaa5243 100644 (file)
@@ -415,17 +415,20 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
 
                 if let Some(ref m) = krate.module {
                     if let None | Some("") = m.doc_value() {
-                        let mut diag = tcx.struct_lint_node(
+                        let help = "The following guide may be of use:\n\
+                             https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\
+                             .html";
+                        tcx.struct_lint_node(
                             rustc_lint::builtin::MISSING_CRATE_LEVEL_DOC,
                             ctxt.as_local_hir_id(m.def_id).unwrap(),
-                            "no documentation found for this crate's top-level module",
-                        );
-                        diag.help(
-                            "The following guide may be of use:\n\
-                             https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\
-                             .html",
+                            |lint| {
+                                let mut diag = lint.build(
+                                    "no documentation found for this crate's top-level module",
+                                );
+                                diag.help(help);
+                                diag.emit();
+                            },
                         );
-                        diag.emit();
                     }
                 }