NiceRegionError: Use written return type for async fn
This commit is contained in:
parent
6487845884
commit
5c15ad7fca
13 changed files with 181 additions and 165 deletions
|
@ -2726,6 +2726,10 @@ pub struct FnHeader {
|
|||
}
|
||||
|
||||
impl FnHeader {
|
||||
pub fn is_async(&self) -> bool {
|
||||
matches!(&self.asyncness, IsAsync::Async)
|
||||
}
|
||||
|
||||
pub fn is_const(&self) -> bool {
|
||||
matches!(&self.constness, Constness::Const)
|
||||
}
|
||||
|
@ -3169,7 +3173,7 @@ impl<'hir> Node<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fn_decl(&self) -> Option<&FnDecl<'hir>> {
|
||||
pub fn fn_decl(&self) -> Option<&'hir FnDecl<'hir>> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
|
||||
|
@ -3181,6 +3185,15 @@ impl<'hir> Node<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig(&self) -> Option<&'hir FnSig<'hir>> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::Item(Item { kind: ItemKind::Fn(fn_sig, _, _), .. }) => Some(fn_sig),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn body_id(&self) -> Option<BodyId> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue