Skip to content

Commit faaab52

Browse files
committed
Add a header method to FnKind
1 parent 6ed6f14 commit faaab52

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc/hir/intravisit.rs

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ impl<'a> FnKind<'a> {
5757
FnKind::Closure(attrs) => attrs,
5858
}
5959
}
60+
61+
pub fn header(&self) -> Option<FnHeader> {
62+
match *self {
63+
FnKind::ItemFn(_, _, header, _, _) => Some(header),
64+
FnKind::Method(_, sig, _, _) => Some(sig.header),
65+
FnKind::Closure(_) => None,
66+
}
67+
}
6068
}
6169

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

0 commit comments

Comments
 (0)