diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b44c3df..8749391 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.73.0" +channel = "1.79.0" components = ["rustfmt", "clippy"] diff --git a/src/prelude.rs b/src/prelude.rs index 9ba08e1..aa0cf4d 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,4 +1,6 @@ pub use crate::{end_group, start_group, start_opened_group}; +#[allow(unused_imports)] pub use anyhow::{anyhow, bail, ensure, Context, Error, Result}; pub use itertools::Itertools; +#[allow(unused_imports)] pub use log::{debug, error, info, trace, warn}; diff --git a/src/run/check_system.rs b/src/run/check_system.rs index ffd182b..416c00d 100644 --- a/src/run/check_system.rs +++ b/src/run/check_system.rs @@ -41,7 +41,7 @@ impl SystemInfo { } impl SystemInfo { - fn new() -> Result { + pub fn new() -> Result { let os = System::name().ok_or(anyhow!("Failed to get OS name"))?; let os_version = System::os_version().ok_or(anyhow!("Failed to get OS version"))?; let arch = System::cpu_arch().ok_or(anyhow!("Failed to get CPU architecture"))?; @@ -58,15 +58,14 @@ impl SystemInfo { } } -/// Checks if the system is supported and returns the system info +/// Checks if the provided system info is supported /// /// Supported systems: /// - Ubuntu 20.04 on x86_64 /// - Ubuntu 22.04 on x86_64 /// - Debian 11 on x86_64 /// - Debian 12 on x86_64 -pub fn check_system() -> Result { - let system_info = SystemInfo::new()?; +pub fn check_system(system_info: &SystemInfo) -> Result<()> { debug!("System info: {:#?}", system_info); match (system_info.os.as_str(), system_info.os_version.as_str()) { @@ -79,5 +78,5 @@ pub fn check_system() -> Result { bail!("Only x86_64 is supported at the moment"); } - Ok(system_info) + Ok(()) } diff --git a/src/run/mod.rs b/src/run/mod.rs index b1b03aa..7324667 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -3,6 +3,7 @@ use crate::config::CodSpeedConfig; use crate::prelude::*; use crate::run::{config::Config, logger::Logger}; use crate::VERSION; +use check_system::SystemInfo; use clap::Args; mod check_system; @@ -110,7 +111,9 @@ pub async fn run(args: RunArgs, api_client: &CodSpeedAPIClient) -> Result<()> { config.set_token(codspeed_config.auth.token.clone()); } - let system_info = check_system::check_system()?; + let system_info = SystemInfo::new()?; + check_system::check_system(&system_info)?; + let run_data = runner::run(&config, &system_info).await?; if !config.skip_upload {