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:
commit
4c6edb1df8
3 changed files with 24 additions and 56 deletions
|
@ -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, .. })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue