Clean up lang_items::extract
Noted in https://github.com/rust-lang/rust/pull/87739#pullrequestreview-740497194, lang_items::extract no longer needs to take a closure.
This commit is contained in:
@@ -18,13 +18,9 @@ pub static WEAK_ITEMS_REFS: SyncLazy<StableMap<Symbol, LangItem>> = SyncLazy::ne
|
||||
map
|
||||
});
|
||||
|
||||
/// The `check_name` argument avoids the need for `rustc_hir` to depend on
|
||||
/// `rustc_session`.
|
||||
pub fn link_name<'a, F>(check_name: F, attrs: &'a [ast::Attribute]) -> Option<Symbol>
|
||||
where
|
||||
F: Fn(&'a ast::Attribute, Symbol) -> bool
|
||||
pub fn link_name(attrs: &[ast::Attribute]) -> Option<Symbol>
|
||||
{
|
||||
lang_items::extract(check_name, attrs).and_then(|(name, _)| {
|
||||
lang_items::extract(attrs).and_then(|(name, _)| {
|
||||
$(if name == sym::$name {
|
||||
Some(sym::$sym)
|
||||
} else)* {
|
||||
|
||||
Reference in New Issue
Block a user