1
Fork 0

Auto merge of #50129 - wesleywiser:clean_up1, r=michaelwoerister

Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit

Suggested in the [comments of #49991](https://github.com/rust-lang/rust/pull/49991/files/4a77d35c1ed89310a0ed128ce931cd4b85ca4cd4#r183048939)
This commit is contained in:
bors 2018-04-23 08:26:23 +00:00
commit 1fac3ca9c4

View file

@ -925,18 +925,19 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
}; };
let mir = let mir =
if let hir::ImplItemKind::Const(..) = ast_item.node { match ast_item.node {
true hir::ImplItemKind::Const(..) => true,
} else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node { hir::ImplItemKind::Method(ref sig, _) => {
let generics = self.tcx.generics_of(def_id); let generics = self.tcx.generics_of(def_id);
let types = generics.parent_types as usize + generics.types.len(); let types = generics.parent_types as usize + generics.types.len();
let needs_inline = (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) && let needs_inline =
!self.metadata_output_only(); (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline())
let is_const_fn = sig.constness == hir::Constness::Const; && !self.metadata_output_only();
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; let is_const_fn = sig.constness == hir::Constness::Const;
needs_inline || is_const_fn || always_encode_mir let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
} else { needs_inline || is_const_fn || always_encode_mir
false },
hir::ImplItemKind::Type(..) => false,
}; };
Entry { Entry {