From 5bb9333ae92378b2333d7f7e09d279eaaf916bd7 Mon Sep 17 00:00:00 2001 From: Fangyi Zhou Date: Wed, 22 May 2024 10:04:04 +0100 Subject: [PATCH] Add i32/u32 suffix for numeric literals in 04_traits/01_trait (#20) Without an explicit suffix, the compiler is able to use the i32 implementation without the need for an u32 implementation. --- exercises/04_traits/01_trait/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/04_traits/01_trait/src/lib.rs b/exercises/04_traits/01_trait/src/lib.rs index b0f6e70..258eac5 100644 --- a/exercises/04_traits/01_trait/src/lib.rs +++ b/exercises/04_traits/01_trait/src/lib.rs @@ -9,15 +9,15 @@ mod tests { #[test] fn test_u32_is_even() { - assert!(42.is_even()); - assert!(!43.is_even()); + assert!(42u32.is_even()); + assert!(!43u32.is_even()); } #[test] fn test_i32_is_even() { - assert!(42.is_even()); - assert!(!43.is_even()); - assert!(0.is_even()); - assert!(!(-1).is_even()); + assert!(42i32.is_even()); + assert!(!43i32.is_even()); + assert!(0i32.is_even()); + assert!(!(-1i32).is_even()); } } -- 2.45.2