diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-12-30 18:15:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-30 18:15:16 +0900 |
| commit | 30ddc91d41b1160a3a2594ea4a5fa6140a5186c1 (patch) | |
| tree | d27044126da42084f2b6b00a7878b8292afdb967 | |
| parent | 7c57d51a9f1b32e1cc507faec46b411cd42e90b5 (diff) | |
| parent | 3dae414cb6f9bc8d4e94c96f0676a7998f82692f (diff) | |
| download | rust-30ddc91d41b1160a3a2594ea4a5fa6140a5186c1.tar.gz rust-30ddc91d41b1160a3a2594ea4a5fa6140a5186c1.zip | |
Rollup merge of #80464 - LingMan:map_or, r=oli-obk
Use Option::map_or instead of open coding it ``@rustbot`` modify labels +C-cleanup +T-compiler
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 56e1f9989b0..6a9d6d2ed12 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -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, |
