Remove AstDeref.

It's a "utility trait to reduce boilerplate" implemented for `P` and
`AstNodeWrapper`, but removing it gives a net reduction of twenty lines
of code. It's also simpler to just implement
`HasNodeId`/`HasAttrs`/`HasTokens` directly on types instead of via
`AstDeref`.

(I decided to make this change when doing some related refactoring and
the error messages involving `AstDeref` and `HasAttrs` were hard to
understand; removing it helped a lot.)
This commit is contained in:
Nicholas Nethercote
2025-05-09 13:18:19 +10:00
parent d22461c9b7
commit 5ebcbfc1e1
4 changed files with 36 additions and 56 deletions

View File

@@ -308,7 +308,6 @@ impl ParenthesizedArgs {
}
}
use crate::AstDeref;
pub use crate::node_id::{CRATE_NODE_ID, DUMMY_NODE_ID, NodeId};
/// Modifiers on a trait bound like `~const`, `?` and `!`.
@@ -2349,7 +2348,7 @@ impl Ty {
pub fn is_maybe_parenthesised_infer(&self) -> bool {
match &self.kind {
TyKind::Infer => true,
TyKind::Paren(inner) => inner.ast_deref().is_maybe_parenthesised_infer(),
TyKind::Paren(inner) => inner.is_maybe_parenthesised_infer(),
_ => false,
}
}