Skip to content

Commit 0917b21

Browse files
committed
build-manifest: move PkgType into the versions module
1 parent b9af3e3 commit 0917b21

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

src/tools/build-manifest/src/main.rs

+4-31
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
//! via `x.py dist hash-and-sign`; the cmdline arguments are set up
55
//! by rustbuild (in `src/bootstrap/dist.rs`).
66
7-
use serde::Serialize;
7+
mod versions;
88

9+
use crate::versions::PkgType;
10+
use serde::Serialize;
911
use std::collections::BTreeMap;
1012
use std::collections::HashMap;
1113
use std::env;
@@ -336,35 +338,6 @@ fn main() {
336338
.build();
337339
}
338340

339-
enum PkgType {
340-
RustSrc,
341-
Cargo,
342-
Rls,
343-
RustAnalyzer,
344-
Clippy,
345-
Rustfmt,
346-
LlvmTools,
347-
Miri,
348-
Other,
349-
}
350-
351-
impl PkgType {
352-
fn from_component(component: &str) -> Self {
353-
use PkgType::*;
354-
match component {
355-
"rust-src" => RustSrc,
356-
"cargo" => Cargo,
357-
"rls" | "rls-preview" => Rls,
358-
"rust-analyzer" | "rust-analyzer-preview" => RustAnalyzer,
359-
"clippy" | "clippy-preview" => Clippy,
360-
"rustfmt" | "rustfmt-preview" => Rustfmt,
361-
"llvm-tools" | "llvm-tools-preview" => LlvmTools,
362-
"miri" | "miri-preview" => Miri,
363-
_ => Other,
364-
}
365-
}
366-
}
367-
368341
impl Builder {
369342
fn build(&mut self) {
370343
self.rust_version = self.version("rust", "x86_64-unknown-linux-gnu");
@@ -702,7 +675,7 @@ impl Builder {
702675
Rustfmt => format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target),
703676
LlvmTools => format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target),
704677
Miri => format!("miri-{}-{}.tar.gz", self.miri_release, target),
705-
Other => format!("{}-{}-{}.tar.gz", component, self.rust_release, target),
678+
Other(_) => format!("{}-{}-{}.tar.gz", component, self.rust_release, target),
706679
}
707680
}
708681

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
pub(crate) enum PkgType {
2+
RustSrc,
3+
Cargo,
4+
Rls,
5+
RustAnalyzer,
6+
Clippy,
7+
Rustfmt,
8+
LlvmTools,
9+
Miri,
10+
Other(String),
11+
}
12+
13+
impl PkgType {
14+
pub(crate) fn from_component(component: &str) -> Self {
15+
match component {
16+
"rust-src" => PkgType::RustSrc,
17+
"cargo" => PkgType::Cargo,
18+
"rls" | "rls-preview" => PkgType::Rls,
19+
"rust-analyzer" | "rust-analyzer-preview" => PkgType::RustAnalyzer,
20+
"clippy" | "clippy-preview" => PkgType::Clippy,
21+
"rustfmt" | "rustfmt-preview" => PkgType::Rustfmt,
22+
"llvm-tools" | "llvm-tools-preview" => PkgType::LlvmTools,
23+
"miri" | "miri-preview" => PkgType::Miri,
24+
other => PkgType::Other(other.into()),
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)