]> git.lizzy.rs Git - rust.git/commitdiff
Improve code readability
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 11 Feb 2020 12:16:38 +0000 (13:16 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 22 Mar 2020 12:01:42 +0000 (13:01 +0100)
src/librustdoc/core.rs

index 47b6699368ccf1d7bd6264b43638e557adbced7f..116bb70dcf62f52039147ec3d4d6ba3271f14e39 100644 (file)
@@ -414,19 +414,18 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
                 let mut krate = clean::krate(&mut ctxt);
 
                 if let Some(ref m) = krate.module {
-                    match m.doc_value() {
-                        None | Some("") => {
-                            let mut diag = tcx.struct_lint_node(
-                                rustc_lint::builtin::MISSING_CRATE_LEVEL_DOC,
-                                ctxt.as_local_hir_id(m.def_id).unwrap(),
-                                "No documentation found on this crate top module.\n\n\
-                                 Maybe you could be interested into looking at this documentation:\n\
-                                 https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\
-                                 .html"
-                            );
-                            diag.emit();
-                        }
-                        _ => {}
+                    if let None | Some("") = m.doc_value() {
+                        let mut diag = 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",
+                        );
+                        diag.emit();
                     }
                 }