Skip to content

Commit 3dae414

Browse files
committed
Use Option::map_or instead of open coding it
1 parent 2987785 commit 3dae414

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
397397
match i.kind {
398398
ast::ForeignItemKind::Fn(..) | ast::ForeignItemKind::Static(..) => {
399399
let link_name = self.sess.first_attr_value_str_by_name(&i.attrs, sym::link_name);
400-
let links_to_llvm = match link_name {
401-
Some(val) => val.as_str().starts_with("llvm."),
402-
_ => false,
403-
};
400+
let links_to_llvm =
401+
link_name.map_or(false, |val| val.as_str().starts_with("llvm."));
404402
if links_to_llvm {
405403
gate_feature_post!(
406404
&self,

0 commit comments

Comments
 (0)