Rollup merge of #138376 - nnethercote:hir-ItemKind-ident-precursors, r=compiler-errors

Item-related cleanups

I have been looking at `hir::Item` closely and found a few minor cleanup opportunities.

r? ```@spastorino```
This commit is contained in:
Matthias Krüger 2025-03-12 08:06:51 +01:00 committed by GitHub
commit 4c6edb1df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 56 deletions

View file

@ -4332,16 +4332,6 @@ pub enum OwnerNode<'hir> {
}
impl<'hir> OwnerNode<'hir> {
pub fn ident(&self) -> Option<Ident> {
match self {
OwnerNode::Item(Item { ident, .. })
| OwnerNode::ForeignItem(ForeignItem { ident, .. })
| OwnerNode::ImplItem(ImplItem { ident, .. })
| OwnerNode::TraitItem(TraitItem { ident, .. }) => Some(*ident),
OwnerNode::Crate(..) | OwnerNode::Synthetic => None,
}
}
pub fn span(&self) -> Span {
match self {
OwnerNode::Item(Item { span, .. })