Reuse logic for determining the channel in the rest of rustdoc

This doesn't update main.js because it's included as a fixed string.
This commit is contained in:
Joshua Nelson
2021-04-06 14:51:36 -04:00
parent 9866ea0ac5
commit 3478f83c0a
5 changed files with 29 additions and 22 deletions

View File

@@ -498,15 +498,18 @@ crate fn run_global_ctxt(
let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt));
if krate.module.doc_value().map(|d| d.is_empty()).unwrap_or(true) {
let help = "The following guide may be of use:\n\
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
let help = format!(
"The following guide may be of use:\n\
https://doc.rust-lang.org/{}/rustdoc/how-to-write-documentation.html",
crate::doc_rust_lang_org_channel(),
);
tcx.struct_lint_node(
crate::lint::MISSING_CRATE_LEVEL_DOCS,
DocContext::as_local_hir_id(tcx, krate.module.def_id).unwrap(),
|lint| {
let mut diag =
lint.build("no documentation found for this crate's top-level module");
diag.help(help);
diag.help(&help);
diag.emit();
},
);