expand: Remove redundant calls to configure
Starting from https://github.com/rust-lang/rust/pull/63468 cfg attributes on variants, fields, fn params etc. are processed together with other attributes (via `configure!`).
This commit is contained in:
parent
18c94b3edd
commit
6e11a8b66a
1 changed files with 3 additions and 21 deletions
|
@ -1067,8 +1067,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
fn visit_expr(&mut self, expr: &mut P<ast::Expr>) {
|
fn visit_expr(&mut self, expr: &mut P<ast::Expr>) {
|
||||||
self.cfg.configure_expr(expr);
|
self.cfg.configure_expr(expr);
|
||||||
visit_clobber(expr.deref_mut(), |mut expr| {
|
visit_clobber(expr.deref_mut(), |mut expr| {
|
||||||
self.cfg.configure_expr_kind(&mut expr.kind);
|
|
||||||
|
|
||||||
if let Some(attr) = self.take_first_attr(&mut expr) {
|
if let Some(attr) = self.take_first_attr(&mut expr) {
|
||||||
// Collect the invoc regardless of whether or not attributes are permitted here
|
// Collect the invoc regardless of whether or not attributes are permitted here
|
||||||
// expansion will eat the attribute so it won't error later.
|
// expansion will eat the attribute so it won't error later.
|
||||||
|
@ -1166,8 +1164,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
fn filter_map_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
|
fn filter_map_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
|
||||||
let expr = configure!(self, expr);
|
let expr = configure!(self, expr);
|
||||||
expr.filter_map(|mut expr| {
|
expr.filter_map(|mut expr| {
|
||||||
self.cfg.configure_expr_kind(&mut expr.kind);
|
|
||||||
|
|
||||||
if let Some(attr) = self.take_first_attr(&mut expr) {
|
if let Some(attr) = self.take_first_attr(&mut expr) {
|
||||||
self.cfg.maybe_emit_expr_attr_err(&attr.0);
|
self.cfg.maybe_emit_expr_attr_err(&attr.0);
|
||||||
|
|
||||||
|
@ -1192,7 +1188,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_pat(&mut self, pat: &mut P<ast::Pat>) {
|
fn visit_pat(&mut self, pat: &mut P<ast::Pat>) {
|
||||||
self.cfg.configure_pat(pat);
|
|
||||||
match pat.kind {
|
match pat.kind {
|
||||||
PatKind::MacCall(_) => {}
|
PatKind::MacCall(_) => {}
|
||||||
_ => return noop_visit_pat(pat, self),
|
_ => return noop_visit_pat(pat, self),
|
||||||
|
@ -1406,15 +1401,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_foreign_mod(&mut self, foreign_mod: &mut ast::ForeignMod) {
|
|
||||||
self.cfg.configure_foreign_mod(foreign_mod);
|
|
||||||
noop_visit_foreign_mod(foreign_mod, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flat_map_foreign_item(
|
fn flat_map_foreign_item(
|
||||||
&mut self,
|
&mut self,
|
||||||
mut foreign_item: P<ast::ForeignItem>,
|
foreign_item: P<ast::ForeignItem>,
|
||||||
) -> SmallVec<[P<ast::ForeignItem>; 1]> {
|
) -> SmallVec<[P<ast::ForeignItem>; 1]> {
|
||||||
|
let mut foreign_item = configure!(self, foreign_item);
|
||||||
|
|
||||||
if let Some(attr) = self.take_first_attr(&mut foreign_item) {
|
if let Some(attr) = self.take_first_attr(&mut foreign_item) {
|
||||||
return self
|
return self
|
||||||
.collect_attr(
|
.collect_attr(
|
||||||
|
@ -1439,11 +1431,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item_kind(&mut self, item: &mut ast::ItemKind) {
|
|
||||||
self.cfg.configure_item_kind(item);
|
|
||||||
noop_visit_item_kind(item, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flat_map_generic_param(
|
fn flat_map_generic_param(
|
||||||
&mut self,
|
&mut self,
|
||||||
param: ast::GenericParam,
|
param: ast::GenericParam,
|
||||||
|
@ -1602,11 +1589,6 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
*id = self.cx.resolver.next_node_id()
|
*id = self.cx.resolver.next_node_id()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_fn_decl(&mut self, mut fn_decl: &mut P<ast::FnDecl>) {
|
|
||||||
self.cfg.configure_fn_decl(&mut fn_decl);
|
|
||||||
noop_visit_fn_decl(fn_decl, self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExpansionConfig<'feat> {
|
pub struct ExpansionConfig<'feat> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue