From cddb85df05dc7de8f3cd2296347b43ae1c2742df Mon Sep 17 00:00:00 2001 From: Corwin Date: Wed, 6 Mar 2024 17:33:34 +0000 Subject: [PATCH] use num traits --- agb-fixnum/Cargo.toml | 2 +- agb-fixnum/src/lib.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/agb-fixnum/Cargo.toml b/agb-fixnum/Cargo.toml index 63d2002c..cb53480f 100644 --- a/agb-fixnum/Cargo.toml +++ b/agb-fixnum/Cargo.toml @@ -8,4 +8,4 @@ repository = "https://github.com/agbrs/agb" [dependencies] agb_macros = { version = "0.19.1", path = "../agb-macros" } -num = { version = "0.4", default-features = false } +num-traits = { version = "0.2", default-features = false } diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index 7df4964c..56fd3979 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -170,7 +170,7 @@ fixed_width_signed_integer_impl!(i32); #[repr(transparent)] pub struct Num(I); -impl num::Zero for Num { +impl num_traits::Zero for Num { fn zero() -> Self { Self::new(I::zero()) } @@ -180,19 +180,19 @@ impl num::Zero for Num { } } -impl num::One for Num { +impl num_traits::One for Num { fn one() -> Self { Self::new(I::one()) } } -impl num::Num for Num { - type FromStrRadixErr = ::FromStrRadixErr; +impl num_traits::Num for Num { + type FromStrRadixErr = ::FromStrRadixErr; fn from_str_radix(str: &str, radix: u32) -> Result { // for some reason, if I don't have this it's an error, and if I do it is unused #[allow(unused_imports)] - use num::traits::float::FloatCore; + use num_traits::float::FloatCore; let v: f64 = f64::from_str_radix(str, radix)?; @@ -1166,7 +1166,7 @@ mod tests { use super::*; use alloc::format; - use num::Num as _; + use num_traits::Num as _; #[test] fn formats_whole_numbers_correctly() {