Skip to content

Commit

Permalink
simplify Builder::doc_rust_lang_org_channel
Browse files Browse the repository at this point in the history
This is already handled at the config parsing level, so we can simplify it.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jun 17, 2024
1 parent 207c5bc commit 5ae2446
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,23 +1036,12 @@ impl<'a> Builder<'a> {
}

pub fn doc_rust_lang_org_channel(&self) -> String {
// When using precompiled compiler from CI, we need to use CI rustc's channel and
// ignore `rust.channel` from the configuration. Otherwise most of the rustdoc tests
// will fail due to incompatible `DOC_RUST_LANG_ORG_CHANNEL`.
let channel = if let Some(commit) = self.config.download_rustc_commit() {
self.config
.read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
.trim()
.to_owned()
} else {
match &*self.config.channel {
"stable" => &self.version,
"beta" => "beta",
"nightly" | "dev" => "nightly",
// custom build of rustdoc maybe? link to the latest stable docs just in case
_ => "stable",
}
.to_owned()
let channel = match &*self.config.channel {
"stable" => &self.version,
"beta" => "beta",
"nightly" | "dev" => "nightly",
// custom build of rustdoc maybe? link to the latest stable docs just in case
_ => "stable",
};

format!("https://doc.rust-lang.org/{channel}")
Expand Down

0 comments on commit 5ae2446

Please sign in to comment.