added skip system info flag, and ran clippy

This commit is contained in:
2026-03-24 16:40:03 +01:00
parent 03b1b54299
commit 88806c8822
4 changed files with 19 additions and 13 deletions

View File

@@ -125,7 +125,7 @@ pub fn calculate_primes(range_start: u64, range_end: u64) -> u64 {
current_number = 3; current_number = 3;
} }
if current_number % 2 == 0 { if current_number.is_multiple_of(2) {
current_number += 1; current_number += 1;
} }
@@ -147,7 +147,7 @@ pub fn is_number_prime(number: u64) -> bool {
let search_limit = (number as f64).sqrt() as u64; let search_limit = (number as f64).sqrt() as u64;
for i in (3..=search_limit).step_by(2) { for i in (3..=search_limit).step_by(2) {
if number % i == 0 { if number.is_multiple_of(i) {
return false; return false;
} }
} }

View File

@@ -4,7 +4,7 @@ pub mod benchmark;
pub mod slimes; pub mod slimes;
pub fn application_header() -> &'static str { pub fn application_header() -> &'static str {
let ascii_art = r#" r#"
.---. .---.
.' '. < CPU SLIME > .' '. < CPU SLIME >
/ ^ ^ \ / ^ ^ \
@@ -12,7 +12,7 @@ pub fn application_header() -> &'static str {
| | | |
\ / \ /
'._____.' '._____.'
"#; "#
// println!("{}", ascii_art.bright_green().bold()); // .bright_green()
ascii_art // .bold()
} }

View File

@@ -15,6 +15,10 @@ pub struct Cli {
#[arg(short, long)] #[arg(short, long)]
pub skip_benchmark: bool, pub skip_benchmark: bool,
/// Skil system info
#[arg(short = 'S', long)]
pub skip_system_info: bool,
/// Benchmark: Upper limit for prime calculation (higher number = longer test) /// Benchmark: Upper limit for prime calculation (higher number = longer test)
#[arg(short, long, default_value_t = 500_000)] #[arg(short, long, default_value_t = 500_000)]
pub prime_limit: u64, pub prime_limit: u64,
@@ -34,6 +38,7 @@ fn main() {
println!("{}", application_header().bright_blue()); println!("{}", application_header().bright_blue());
if !cli.skip_system_info {
let slimes = get_all_slimes(); let slimes = get_all_slimes();
let mut sys = System::new_all(); let mut sys = System::new_all();
@@ -43,6 +48,7 @@ fn main() {
slime.print(&sys); slime.print(&sys);
} }
println!(); println!();
}
if !cli.skip_benchmark { if !cli.skip_benchmark {
let logical_core_count = match cli.jobs { let logical_core_count = match cli.jobs {

View File

@@ -17,7 +17,7 @@ pub trait Slime {
format!("{}:", self.label()).bold().color(self.color()) format!("{}:", self.label()).bold().color(self.color())
); );
} else { } else {
print!("{} {:<10} ", " ", " "); print!(" {:<10} ", " ");
} }
println!("{}", val.white()); println!("{}", val.white());
} }