diff options
| author | Eric Huss <eric@huss.org> | 2022-01-09 13:41:04 -0800 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2022-01-09 13:41:04 -0800 |
| commit | 2b7572092c9953cd82d99768732e624bd6da56e9 (patch) | |
| tree | a8120f7ada64a5221020e595396a8de5c611d73a /compiler/rustc_passes/src | |
| parent | f7bb8e3677ba4277914e85a3060e5d69151aed44 (diff) | |
| download | rust-2b7572092c9953cd82d99768732e624bd6da56e9.tar.gz rust-2b7572092c9953cd82d99768732e624bd6da56e9.zip | |
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.
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/lang_items.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/weak_lang_items.rs | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index a808d6c8348..0c934ecc913 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs @@ -10,7 +10,6 @@ use crate::check_attr::target_from_impl_item; use crate::weak_lang_items; -use rustc_ast::Attribute; use rustc_errors::{pluralize, struct_span_err}; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -57,8 +56,7 @@ impl<'tcx> LanguageItemCollector<'tcx> { fn check_for_lang(&mut self, actual_target: Target, hir_id: HirId) { let attrs = self.tcx.hir().attrs(hir_id); - let check_name = |attr: &Attribute, sym| attr.has_name(sym); - if let Some((value, span)) = extract(check_name, &attrs) { + if let Some((value, span)) = extract(&attrs) { match ITEM_REFS.get(&value).cloned() { // Known lang item with attribute on correct target. Some((item_index, expected_target)) if actual_target == expected_target => { diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index 61c82f031dd..21514d19f6a 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -1,6 +1,5 @@ //! Validity checking for weak lang items -use rustc_ast::Attribute; use rustc_data_structures::fx::FxHashSet; use rustc_errors::struct_span_err; use rustc_hir as hir; @@ -103,9 +102,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { } fn visit_foreign_item(&mut self, i: &hir::ForeignItem<'_>) { - let check_name = |attr: &Attribute, sym| attr.has_name(sym); let attrs = self.tcx.hir().attrs(i.hir_id()); - if let Some((lang_item, _)) = lang_items::extract(check_name, attrs) { + if let Some((lang_item, _)) = lang_items::extract(attrs) { self.register(lang_item, i.span); } intravisit::walk_foreign_item(self, i) |
