From ec616d584676e5083c68ed1367b94e9e824d8945 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 4 May 2016 22:15:47 -0500 Subject: [PATCH] refactor: if -> match --- src/librustc_back/target/mod.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index a13a94e12e5d6..d7c68d9f2a98d 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -69,19 +69,18 @@ macro_rules! supported_targets { /// List of supported targets pub const TARGETS: &'static [&'static str] = &[$($triple),*]; - // this would use a match if stringify! were allowed in pattern position fn load_specific(target: &str) -> Option { - if false { } - $( - else if target == $triple { - let mut t = $module::target(); - t.options.is_builtin = true; - debug!("Got builtin target: {:?}", t); - return Some(t); - } - )* - - None + match target { + $( + $triple => { + let mut t = $module::target(); + t.options.is_builtin = true; + debug!("Got builtin target: {:?}", t); + Some(t) + }, + )+ + _ => None + } } ) }