Skip to content

Commit 030fb05

Browse files
ehussXAMPPRocky
authored andcommitted
Fix src download links.
1 parent 113d897 commit 030fb05

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

blacksmith/src/lib.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,17 @@ impl Blacksmith {
205205

206206
let stable_links = platform.stable
207207
.as_ref()
208-
.map(|version| generate_standalone_links(version, name, extension))
208+
.map(|version| generate_standalone_links("rust", version, name, extension))
209209
.unwrap_or_else(String::new);
210210

211211
let beta_links = if platform.beta {
212-
generate_standalone_links("beta", name, extension)
212+
generate_standalone_links("rust", "beta", name, extension)
213213
} else {
214214
String::new()
215215
};
216216

217217
let nightly_links = if platform.nightly {
218-
generate_standalone_links("nightly", name, extension)
218+
generate_standalone_links("rust", "nightly", name, extension)
219219
} else {
220220
String::new()
221221
};
@@ -242,18 +242,18 @@ impl Blacksmith {
242242
writeln!(buffer, "--------|----------------------").unwrap();
243243

244244
for &channel in CHANNELS {
245-
let display = if channel == "stable" {
246-
format!("stable ({})", self.stable_version.as_ref().unwrap())
245+
if channel == "stable" {
246+
let stable_version = self.stable_version.as_ref().unwrap();
247+
writeln!(buffer, "stable ({}) | {}",
248+
stable_version,
249+
generate_standalone_links("rustc", stable_version, "src", "tar.gz")
250+
).unwrap();
247251
} else {
248-
channel.into()
249-
};
250-
251-
writeln!(
252-
buffer,
253-
"{display} | {links}",
254-
display = display,
255-
links = generate_standalone_links(&channel, "src", "tar.gz")
256-
).unwrap();
252+
writeln!(buffer, "{} | {}",
253+
channel,
254+
generate_standalone_links("rustc", &channel, "src", "tar.gz")
255+
).unwrap();
256+
}
257257
}
258258

259259
buffer
@@ -262,12 +262,13 @@ impl Blacksmith {
262262

263263
/// Generates links to standalone installers provided a rust version or channel,
264264
/// target name, and file extension.
265-
fn generate_standalone_links(stem: &str, name: &str, extension: &str) -> String {
265+
fn generate_standalone_links(base: &str, stem: &str, name: &str, extension: &str) -> String {
266266
let url = format!(
267-
"https://static.rust-lang.org/dist/rust-{stem}-{name}.{extension}",
267+
"https://static.rust-lang.org/dist/{base}-{stem}-{name}.{extension}",
268268
extension = extension,
269269
name = name,
270270
stem = stem,
271+
base = base,
271272
);
272273

273274
format!(

0 commit comments

Comments
 (0)