From 9ae2b39a276472ecd7afaec0a412c6b793c98ed3 Mon Sep 17 00:00:00 2001 From: TrentGL Date: Mon, 7 Oct 2024 17:43:30 -0400 Subject: [PATCH] feat(common): fallback to std::env::consts::ARCH for System::cpu_arch --- src/common/system.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/system.rs b/src/common/system.rs index 588b8c09e..e572b9a2f 100644 --- a/src/common/system.rs +++ b/src/common/system.rs @@ -777,8 +777,8 @@ impl System { /// /// println!("CPU Architecture: {:?}", System::cpu_arch()); /// ``` - pub fn cpu_arch() -> Option { - SystemInner::cpu_arch() + pub fn cpu_arch() -> String { + SystemInner::cpu_arch().unwrap_or_else(|| std::env::consts::ARCH.to_owned()) } } @@ -2462,7 +2462,7 @@ mod test { #[test] fn check_cpu_arch() { - assert_eq!(System::cpu_arch().is_some(), IS_SUPPORTED_SYSTEM); + assert_eq!(!System::cpu_arch().is_empty(), IS_SUPPORTED_SYSTEM); } // Ensure that the CPUs frequency isn't retrieved until we ask for it.