Skip to content

Commit

Permalink
Add a header method to FnKind
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Apr 20, 2019
1 parent 4530c52 commit c0ad4b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustc/hir/intravisit.rs
Expand Up @@ -57,6 +57,14 @@ impl<'a> FnKind<'a> {
FnKind::Closure(attrs) => attrs,
}
}

pub fn header(&self) -> Option<FnHeader> {
match *self {
FnKind::ItemFn(_, _, header, _, _) => Some(header),
FnKind::Method(_, sig, _, _) => Some(sig.header),
FnKind::Closure(_) => None,
}
}
}

/// Specifies what nested things a visitor wants to visit. The most
Expand Down

0 comments on commit c0ad4b0

Please sign in to comment.