From afaf4e5e76d1f5463645d525504be0b681c00a81 Mon Sep 17 00:00:00 2001 From: Abdelilah SADIQUI <143453064+sadiqui@users.noreply.github.com> Date: Sun, 17 Aug 2025 01:40:49 +0100 Subject: [PATCH] refactor(solutions/min_and_max): leverage built-in methods --- solutions/min_and_max/src/lib.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/solutions/min_and_max/src/lib.rs b/solutions/min_and_max/src/lib.rs index 6a74f52e..3fd1de80 100644 --- a/solutions/min_and_max/src/lib.rs +++ b/solutions/min_and_max/src/lib.rs @@ -1,19 +1,3 @@ pub fn min_and_max(nb_1: i32, nb_2: i32, nb_3: i32) -> (i32, i32) { - let mut tmp_min = nb_1; - let mut tmp_max = nb_1; - - if nb_2 < tmp_min { - tmp_min = nb_2; - } - if nb_2 > tmp_max { - tmp_max = nb_2; - } - if nb_3 < tmp_min { - tmp_min = nb_3; - } - if nb_3 > tmp_max { - tmp_max = nb_3; - } - - (tmp_min, tmp_max) + (nb_1.min(nb_2).min(nb_3), nb_1.max(nb_2).max(nb_3)) }