diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2016-05-04 22:15:47 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2016-05-04 22:15:47 -0500 |
| commit | ec616d584676e5083c68ed1367b94e9e824d8945 (patch) | |
| tree | a60e9838e5e8d9cd4a8e019419f513fdae3e0e76 | |
| parent | 59435072f58e1d622e1664f0a7e44830891c958f (diff) | |
refactor: if -> match
| -rw-r--r-- | src/librustc_back/target/mod.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index a13a94e12e5..d7c68d9f2a9 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<Target> { - 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 + } } ) } |
