From f28c05b0ee53a438b6b2a21d448481ed604b14a5 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 18 Mar 2023 20:35:48 +1100 Subject: [PATCH] Fix `QuickInstall` report bug for target `universal2-apple-darwin` (#921) This bug was reintroduced by #919 and it was fixed by #918 Signed-off-by: Jiahao XU --- crates/binstalk/src/fetchers/quickinstall.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/binstalk/src/fetchers/quickinstall.rs b/crates/binstalk/src/fetchers/quickinstall.rs index 7a3d4b86..cb071c6b 100644 --- a/crates/binstalk/src/fetchers/quickinstall.rs +++ b/crates/binstalk/src/fetchers/quickinstall.rs @@ -20,6 +20,10 @@ use super::{Data, TargetData}; const BASE_URL: &str = "https://github.com/cargo-bins/cargo-quickinstall/releases/download"; const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate"; +fn is_universal_macos(target: &str) -> bool { + ["universal-apple-darwin", "universal2-apple-darwin"].contains(&target) +} + pub struct QuickInstall { client: Client, gh_api_client: GhApiClient, @@ -63,7 +67,7 @@ impl super::Fetcher for QuickInstall { fn find(self: Arc) -> AutoAbortJoinHandle> { AutoAbortJoinHandle::spawn(async move { - if self.target_data.target == "universal-apple-darwin" { + if is_universal_macos(&self.target_data.target) { return Ok(false); } @@ -79,12 +83,12 @@ impl super::Fetcher for QuickInstall { fn report_to_upstream(self: Arc) { if cfg!(debug_assertions) { debug!("Not sending quickinstall report in debug mode"); - } else if self.target_data.target == "universal-apple-darwin" { + } else if is_universal_macos(&self.target_data.target) { debug!( r#"Not sending quickinstall report for universal-apple-darwin -quickinstall does not support our homebrew target -universal-apple-darwin, it only supports targets supported by -rust officially."#, +and universal2-apple-darwin. +Quickinstall does not support these targets, it only supports targets supported +by rust officially."#, ); } else { tokio::spawn(async move {