Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): fallback to std::env::consts::ARCH for System::cpu_arch #1358

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/common/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ impl System {
///
/// println!("CPU Architecture: {:?}", System::cpu_arch());
/// ```
pub fn cpu_arch() -> Option<String> {
SystemInner::cpu_arch()
pub fn cpu_arch() -> String {
SystemInner::cpu_arch().unwrap_or_else(|| std::env::consts::ARCH.to_owned())
}
}

Expand Down Expand Up @@ -2462,7 +2462,7 @@ mod test {

#[test]
fn check_cpu_arch() {
assert_eq!(System::cpu_arch().is_some(), IS_SUPPORTED_SYSTEM);
assert!(!System::cpu_arch().is_empty());
}

// Ensure that the CPUs frequency isn't retrieved until we ask for it.
Expand Down