diff --git a/src/algorithm/prime.rs b/src/algorithm/prime.rs index 265e00e..9cc629b 100644 --- a/src/algorithm/prime.rs +++ b/src/algorithm/prime.rs @@ -141,11 +141,7 @@ pub fn sqrtest(num: isize) -> Result { // FIXME: https://github.com/rust-lang/rust/issues/116226 // let sqrt_res = num.isqrt().unsigned_abs() let sqrt_res = (num as f64).sqrt().ceil() as usize; - if (3..=sqrt_res) - .into_par_iter() - .find_any(|&i| num.unsigned_abs() % i == 0) - .is_some() - { + if (3..=sqrt_res).into_par_iter().find_any(|&i| num.unsigned_abs() % i == 0).is_some() { Ok(PrimeStatus::Composite) } else { Ok(PrimeStatus::Prime) diff --git a/src/num/radix.rs b/src/num/radix.rs index db2226f..07aebc0 100644 --- a/src/num/radix.rs +++ b/src/num/radix.rs @@ -1,9 +1,9 @@ //! Structs for radix numbers (String nums and int nums). All numbers are unsigned integers. use { + super::methods::Num, std::{cmp::Ordering, num::ParseIntError, ops, str::FromStr}, thiserror::Error, - super::methods::Num, }; /// Reference to slice of chars from '0' to 'Z' (maximum base is 36). @@ -925,18 +925,16 @@ impl Radix { pub fn from_radix(number: usize, base: u8) -> Result { match base { 0 | 1 | 11.. => Err(RadixError::BaseError(10, base)), - _ => { - RADIX - .iter() - .take(10) - .skip(base.into()) - .find_map(|i| { - number - .has_digit(i.to_string().parse().unwrap()) - .then_some(Err(RadixError::NumberError(*i, base))) - }) - .map_or(Ok(Self { number, base }), |err| err) - }, + _ => RADIX + .iter() + .take(10) + .skip(base.into()) + .find_map(|i| { + number + .has_digit(i.to_string().parse().unwrap()) + .then_some(Err(RadixError::NumberError(*i, base))) + }) + .map_or(Ok(Self { number, base }), |err| err), } }