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
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, .. })