1
Fork 0

Rename some name variables as ident.

It bugs me when variables of type `Ident` are called `name`. It leads to
silly things like `name.name`. `Ident` variables should be called
`ident`, and `name` should be used for variables of type `Symbol`.

This commit improves things by by doing `s/name/ident/` on a bunch of
`Ident` variables. Not all of them, but a decent chunk.
This commit is contained in:
Nicholas Nethercote 2025-04-08 12:23:07 +10:00
parent d4f880f8ce
commit 1b3fc585cb
52 changed files with 238 additions and 229 deletions

View file

@ -1102,7 +1102,7 @@ pub trait ResolverExpand {
/// HIR proc macros items back to their harness items.
fn declare_proc_macro(&mut self, id: NodeId);
fn append_stripped_cfg_item(&mut self, parent_node: NodeId, name: Ident, cfg: ast::MetaItem);
fn append_stripped_cfg_item(&mut self, parent_node: NodeId, ident: Ident, cfg: ast::MetaItem);
/// Tools registered with `#![register_tool]` and used by tool attributes and lints.
fn registered_tools(&self) -> &RegisteredTools;

View file

@ -1169,9 +1169,9 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
collector.cx.dcx().emit_err(RemoveNodeNotSupported { span, descr: Self::descr() });
}
/// All of the names (items) declared by this node.
/// All of the idents (items) declared by this node.
/// This is an approximation and should only be used for diagnostics.
fn declared_names(&self) -> Vec<Ident> {
fn declared_idents(&self) -> Vec<Ident> {
vec![]
}
}
@ -1306,7 +1306,7 @@ impl InvocationCollectorNode for P<ast::Item> {
res
}
fn declared_names(&self) -> Vec<Ident> {
fn declared_idents(&self) -> Vec<Ident> {
if let ItemKind::Use(ut) = &self.kind {
fn collect_use_tree_leaves(ut: &ast::UseTree, idents: &mut Vec<Ident>) {
match &ut.kind {
@ -2061,10 +2061,10 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
}
if let Some(meta_item) = meta_item {
for name in node.declared_names() {
for ident in node.declared_idents() {
self.cx.resolver.append_stripped_cfg_item(
self.cx.current_expansion.lint_node_id,
name,
ident,
meta_item.clone(),
)
}