From c2e2d65b0c9c05c6e4b5450e80c3bcc612ce1d6a Mon Sep 17 00:00:00 2001 From: stephenjarso Date: Thu, 4 Jun 2026 00:04:30 +0300 Subject: [PATCH] Fix: Check for u32 first so positive numbers don't get trapped by i32 --- Tasks/Conflicts/code_scenario3.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tasks/Conflicts/code_scenario3.rs b/Tasks/Conflicts/code_scenario3.rs index bb39b5b..1633862 100644 --- a/Tasks/Conflicts/code_scenario3.rs +++ b/Tasks/Conflicts/code_scenario3.rs @@ -31,15 +31,15 @@ fn main() { let input = &args[1]; // The input string to be parsed // Try parsing input as i32 - if let Ok(value) = input.parse::() { - println!("{value} is of type i32: {} bytes", mem::size_of::()); - print_other_types("i32"); - } - // Try parsing input as u32 - else if let Ok(value) = input.parse::() { + if let Ok(value) = input.parse::() { println!("{value} is of type u32: {} bytes", mem::size_of::()); print_other_types("u32"); } + // Try parsing input as u32 + else if let Ok(value) = input.parse::() { + println!("{value} is of type i32: {} bytes", mem::size_of::()); + print_other_types("i32"); + } // Try parsing input as f64 else if let Ok(value) = input.parse::() { println!("{value} is of type f64: {} bytes", mem::size_of::());