mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Simplify code
This commit is contained in:
parent
452cf4f710
commit
04583f29c8
@ -4,21 +4,16 @@ use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
|
||||
let mut finder = Finder { tcx, decls: None };
|
||||
let mut decls = None;
|
||||
|
||||
for id in tcx.hir().items() {
|
||||
let attrs = finder.tcx.hir().attrs(id.hir_id());
|
||||
if finder.tcx.sess.contains_name(attrs, sym::rustc_proc_macro_decls) {
|
||||
finder.decls = Some(id.owner_id.def_id);
|
||||
let attrs = tcx.hir().attrs(id.hir_id());
|
||||
if tcx.sess.contains_name(attrs, sym::rustc_proc_macro_decls) {
|
||||
decls = Some(id.owner_id.def_id);
|
||||
}
|
||||
}
|
||||
|
||||
finder.decls
|
||||
}
|
||||
|
||||
struct Finder<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
decls: Option<LocalDefId>,
|
||||
decls
|
||||
}
|
||||
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
|
Loading…
Reference in New Issue
Block a user