From: alex Date: Fri, 1 Dec 2023 10:30:44 +0000 (+0100) Subject: Utilisation d'un "match" X-Git-Url: https://aoc.elinar.fr/?a=commitdiff_plain;h=e0e0a07b5fe4762899cfe3de78b58e9bebd029bd;p=aoc_2023 Utilisation d'un "match" --- diff --git a/src/main.rs b/src/main.rs index c0378be..080d202 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,10 +18,9 @@ fn main() { } fn run(day: String) -> Result<(), Box> { - if day == "day00" { - day00::run()?; - } else { - return Err(format!("unknown day \"{day}\"").into()); + match day.as_ref() { + "day00" => day00::run()?, + _ => return Err(format!("unknown day \"{day}\"").into()), } Ok(()) }