Skip to content

Commit e026ad5

Browse files
author
hyd-dev
committed
Use unwrap_or_else()
1 parent b054a19 commit e026ad5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/shims/foreign_items.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
213213
) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
214214
let this = self.eval_context_mut();
215215
let attrs = this.tcx.get_attrs(def_id);
216-
let link_name_sym = match this.tcx.sess.first_attr_value_str_by_name(&attrs, sym::link_name)
217-
{
218-
Some(name) => name,
219-
None => this.tcx.item_name(def_id),
220-
};
216+
let link_name_sym = this
217+
.tcx
218+
.sess
219+
.first_attr_value_str_by_name(&attrs, sym::link_name)
220+
.unwrap_or_else(|| this.tcx.item_name(def_id));
221221
let link_name = link_name_sym.as_str();
222222
// Strip linker suffixes (seen on 32-bit macOS).
223223
let link_name = link_name.trim_end_matches("$UNIX2003");

0 commit comments

Comments
 (0)