Use PkgType::is_preview to determine whether to add a rename to the manifest

This caught a missing preview rename for `llvm-tools`.
This commit is contained in:
Joshua Nelson 2022-10-02 00:28:25 -05:00
parent 69a74955fd
commit a3dd94e702
2 changed files with 7 additions and 8 deletions

View file

@ -365,12 +365,11 @@ impl Builder {
let mut rename = |from: &str, to: &str| {
manifest.renames.insert(from.to_owned(), Rename { to: to.to_owned() })
};
rename("rls", "rls-preview");
rename("rustfmt", "rustfmt-preview");
rename("clippy", "clippy-preview");
rename("miri", "miri-preview");
rename("rust-docs-json", "rust-docs-json-preview");
rename("rust-analyzer", "rust-analyzer-preview");
for pkg in PkgType::all() {
if pkg.is_preview() {
rename(pkg.tarball_component_name(), &pkg.manifest_component_name());
}
}
}
fn rust_package(&mut self, manifest: &Manifest) -> Package {

View file

@ -17,7 +17,7 @@ macro_rules! pkg_type {
}
impl PkgType {
fn is_preview(&self) -> bool {
pub(crate) fn is_preview(&self) -> bool {
match self {
$( $( $($is_preview)? PkgType::$variant => true, )? )+
_ => false,
@ -32,7 +32,7 @@ macro_rules! pkg_type {
}
/// First part of the tarball name.
fn tarball_component_name(&self) -> &str {
pub(crate) fn tarball_component_name(&self) -> &str {
match self {
$( PkgType::$variant => $component,)+
PkgType::Other(component) => component,