Skip to content

Commit

Permalink
Use a match guard to avoid code repetition
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Aug 15, 2019
1 parent 5b88fba commit 29b5ebf
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/librustc/middle/reachable.rs
Expand Up @@ -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)
}
Expand Down

0 comments on commit 29b5ebf

Please sign in to comment.