Skip to content

Commit 1fac3ca

Browse files
committed
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)
2 parents f5cf1a8 + 732cc73 commit 1fac3ca

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/librustc_metadata/encoder.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -925,18 +925,19 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
925925
};
926926

927927
let mir =
928-
if let hir::ImplItemKind::Const(..) = ast_item.node {
929-
true
930-
} else if let hir::ImplItemKind::Method(ref sig, _) = ast_item.node {
931-
let generics = self.tcx.generics_of(def_id);
932-
let types = generics.parent_types as usize + generics.types.len();
933-
let needs_inline = (types > 0 || tcx.trans_fn_attrs(def_id).requests_inline()) &&
934-
!self.metadata_output_only();
935-
let is_const_fn = sig.constness == hir::Constness::Const;
936-
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
937-
needs_inline || is_const_fn || always_encode_mir
938-
} else {
939-
false
928+
match ast_item.node {
929+
hir::ImplItemKind::Const(..) => true,
930+
hir::ImplItemKind::Method(ref sig, _) => {
931+
let generics = self.tcx.generics_of(def_id);
932+
let types = generics.parent_types as usize + generics.types.len();
933+
let needs_inline =
934+
(types > 0 || tcx.trans_fn_attrs(def_id).requests_inline())
935+
&& !self.metadata_output_only();
936+
let is_const_fn = sig.constness == hir::Constness::Const;
937+
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
938+
needs_inline || is_const_fn || always_encode_mir
939+
},
940+
hir::ImplItemKind::Type(..) => false,
940941
};
941942

942943
Entry {

0 commit comments

Comments
 (0)