1
Fork 0

Add suggestion to THIR unsafe_op_in_unsafe_fn lint

This commit is contained in:
Matthew Jasper 2023-10-26 15:39:25 +00:00
parent 2b2c0f9886
commit 2b59992736
13 changed files with 381 additions and 54 deletions

View file

@ -3566,6 +3566,15 @@ impl<'hir> OwnerNode<'hir> {
}
}
pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
match self {
OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
| OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
| OwnerNode::Item(Item { kind: ItemKind::Fn(fn_sig, _, _), .. }) => Some(fn_sig),
_ => None,
}
}
pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
match self {
OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })