Skip to content

Commit

Permalink
Rollup merge of rust-lang#80464 - LingMan:map_or, r=oli-obk
Browse files Browse the repository at this point in the history
Use Option::map_or instead of open coding it

`@rustbot` modify labels +C-cleanup +T-compiler
  • Loading branch information
GuillaumeGomez authored Dec 29, 2020
2 parents 8dfde9d + 3dae414 commit ba03726
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
match i.kind {
ast::ForeignItemKind::Fn(..) | ast::ForeignItemKind::Static(..) => {
let link_name = self.sess.first_attr_value_str_by_name(&i.attrs, sym::link_name);
let links_to_llvm = match link_name {
Some(val) => val.as_str().starts_with("llvm."),
_ => false,
};
let links_to_llvm =
link_name.map_or(false, |val| val.as_str().starts_with("llvm."));
if links_to_llvm {
gate_feature_post!(
&self,
Expand Down

0 comments on commit ba03726

Please sign in to comment.