From 732cc736c9450c7f0e7f6413bd04ed6d851b624b Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Fri, 20 Apr 2018 19:05:54 -0400 Subject: [PATCH] Clean up `IsolatedEncoder::encode_info_for_impl_item()` a bit --- src/librustc_metadata/encoder.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b65e9a715faca..d7a06f7932fef 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -925,18 +925,19 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; let mir = - if let hir::ImplItemKind::Const(..) = ast_item.node { - true - } else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node { - let generics = self.tcx.generics_of(def_id); - let types = generics.parent_types as usize + generics.types.len(); - let needs_inline = (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) && - !self.metadata_output_only(); - let is_const_fn = sig.constness == hir::Constness::Const; - let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; - needs_inline || is_const_fn || always_encode_mir - } else { - false + match ast_item.node { + hir::ImplItemKind::Const(..) => true, + hir::ImplItemKind::Method(ref sig, _) => { + let generics = self.tcx.generics_of(def_id); + let types = generics.parent_types as usize + generics.types.len(); + let needs_inline = + (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) + && !self.metadata_output_only(); + let is_const_fn = sig.constness == hir::Constness::Const; + let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; + needs_inline || is_const_fn || always_encode_mir + }, + hir::ImplItemKind::Type(..) => false, }; Entry {