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
This commit is contained in:
Yuki Okushi 2020-12-30 18:15:16 +09:00 committed by GitHub
commit 30ddc91d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -397,10 +397,8 @@ fn visit_foreign_item(&mut self, i: &'a ast::ForeignItem) {
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,