Skip to content

Commit

Permalink
refactor: if -> match
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed May 5, 2016
1 parent 5943507 commit ec616d5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/librustc_back/target/mod.rs
Expand Up @@ -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
}
}
)
}
Expand Down

0 comments on commit ec616d5

Please sign in to comment.