Use a match guard to avoid code repetition
This commit is contained in:
parent
5b88fbabeb
commit
29b5ebf8a5
1 changed files with 5 additions and 8 deletions
|
@ -32,15 +32,12 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
|
|||
return true
|
||||
}
|
||||
|
||||
match item.node {
|
||||
hir::ItemKind::Fn(_, header, ..) => {
|
||||
if header.constness == hir::Constness::Const {
|
||||
return true;
|
||||
}
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
|
||||
generics.requires_monomorphization(tcx)
|
||||
match item.node {
|
||||
hir::ItemKind::Fn(_, header, ..) if header.constness == hir::Constness::Const => {
|
||||
return true;
|
||||
}
|
||||
hir::ItemKind::Impl(..) => {
|
||||
hir::ItemKind::Impl(..) |
|
||||
hir::ItemKind::Fn(..) => {
|
||||
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
|
||||
generics.requires_monomorphization(tcx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue