mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
Use unwrap_or_else()
This commit is contained in:
@@ -213,11 +213,11 @@ fn emulate_foreign_item(
|
||||
) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
|
||||
let this = self.eval_context_mut();
|
||||
let attrs = this.tcx.get_attrs(def_id);
|
||||
let link_name_sym = match this.tcx.sess.first_attr_value_str_by_name(&attrs, sym::link_name)
|
||||
{
|
||||
Some(name) => name,
|
||||
None => this.tcx.item_name(def_id),
|
||||
};
|
||||
let link_name_sym = this
|
||||
.tcx
|
||||
.sess
|
||||
.first_attr_value_str_by_name(&attrs, sym::link_name)
|
||||
.unwrap_or_else(|| this.tcx.item_name(def_id));
|
||||
let link_name = link_name_sym.as_str();
|
||||
// Strip linker suffixes (seen on 32-bit macOS).
|
||||
let link_name = link_name.trim_end_matches("$UNIX2003");
|
||||
|
||||
Reference in New Issue
Block a user