Skip to content

Commit

Permalink
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
Browse files Browse the repository at this point in the history
rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in rust-lang/rust#69589.
  • Loading branch information
Dylan-DPC authored Nov 9, 2020
2 parents 3424419 + c2a769f commit 6294300
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{span_lint, span_lint_and_then};
use rustc_ast::ast::{
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, Item, ItemKind, Local, MacCall, Pat, PatKind,
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, Item, ItemKind, Local, Pat, PatKind,
};
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
use rustc_lint::{EarlyContext, EarlyLintPass};
Expand Down Expand Up @@ -150,9 +150,6 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
_ => walk_pat(self, pat),
}
}
fn visit_mac(&mut self, _mac: &MacCall) {
// do not check macs
}
}

#[must_use]
Expand Down Expand Up @@ -357,9 +354,6 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
fn visit_item(&mut self, _: &Item) {
// do not recurse into inner items
}
fn visit_mac(&mut self, _mac: &MacCall) {
// do not check macs
}
}

impl EarlyLintPass for NonExpressiveNames {
Expand Down

0 comments on commit 6294300

Please sign in to comment.