Pass Ident by reference in ast Visitor

This commit is contained in:
maxcabrajac 2024-10-24 10:41:44 -03:00
parent 5ae4d75eff
commit 64a3451835
10 changed files with 41 additions and 41 deletions

View file

@ -1892,11 +1892,11 @@ impl EarlyLintPass for KeywordIdents {
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::MacCall) {
self.check_tokens(cx, &mac.args.tokens);
}
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: &Ident) {
if ident.name.as_str().starts_with('\'') {
self.check_ident_token(cx, UnderMacro(false), ident.without_first_quote(), "'");
} else {
self.check_ident_token(cx, UnderMacro(false), ident, "");
self.check_ident_token(cx, UnderMacro(false), *ident, "");
}
}
}

View file

@ -190,7 +190,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
ast_visit::walk_ty(self, t);
}
fn visit_ident(&mut self, ident: Ident) {
fn visit_ident(&mut self, ident: &Ident) {
lint_callback!(self, check_ident, ident);
}

View file

@ -133,7 +133,7 @@ macro_rules! early_lint_methods {
($macro:path, $args:tt) => (
$macro!($args, [
fn check_param(a: &rustc_ast::Param);
fn check_ident(a: rustc_span::symbol::Ident);
fn check_ident(a: &rustc_span::symbol::Ident);
fn check_crate(a: &rustc_ast::Crate);
fn check_crate_post(a: &rustc_ast::Crate);
fn check_item(a: &rustc_ast::Item);