about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-02-12 15:48:08 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-03-22 13:01:42 +0100
commit966400253b3c5df2ed96e443d64147244dc6f338 (patch)
tree0d8fb05738b519d2c76cf4bd6a54616ba704bffc /src
parentffe1289fd249d31cd98b2da168281ba860330987 (diff)
downloadrust-966400253b3c5df2ed96e443d64147244dc6f338.tar.gz
rust-966400253b3c5df2ed96e443d64147244dc6f338.zip
Update to new diagnostic
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/core.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 116bb70dcf6..4d2d81e48fc 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -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();
                     }
                 }