From 9d2c4e843ff1a4b311018a6ad15ddbd4944a712b Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 8 Sep 2021 22:06:44 +0530 Subject: Rust: Lucian's Luscious Lasagna: No magic numbers --- rust/lucians-luscious-lasagna/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'rust/lucians-luscious-lasagna') diff --git a/rust/lucians-luscious-lasagna/src/lib.rs b/rust/lucians-luscious-lasagna/src/lib.rs index 19da8d3..06ea99a 100644 --- a/rust/lucians-luscious-lasagna/src/lib.rs +++ b/rust/lucians-luscious-lasagna/src/lib.rs @@ -1,11 +1,15 @@ -pub fn expected_minutes_in_oven() -> i32 { 40 } +pub fn expected_minutes_in_oven() -> i32 { + const EXPECTED_TIME: i32 = 40; + EXPECTED_TIME +} pub fn remaining_minutes_in_oven(actual_minutes_in_oven: i32) -> i32 { expected_minutes_in_oven() - actual_minutes_in_oven } pub fn preparation_time_in_minutes(number_of_layers: i32) -> i32 { - number_of_layers * 2 + const TIME_REQUIRED_FOR_A_LAYER: i32 = 2; + number_of_layers * TIME_REQUIRED_FOR_A_LAYER } pub fn elapsed_time_in_minutes(number_of_layers: i32, -- cgit 1.4.1-2-gfad0