Skip to content

Commit 1d4972e

Browse files
committed
Avoid unnecessary allocation.
1 parent c1d0f0a commit 1d4972e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_codegen_llvm/src/type_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ fn struct_llfields<'a, 'tcx>(
150150
} else {
151151
debug!("struct_llfields: offset: {:?} stride: {:?}", offset, layout.size);
152152
}
153-
154-
(result, packed, padding_used.then_some(Box::new(field_remapping)))
153+
let field_remapping = if padding_used { Some(Box::new(field_remapping)) } else { None };
154+
(result, packed, field_remapping)
155155
}
156156

157157
impl<'a, 'tcx> CodegenCx<'a, 'tcx> {

0 commit comments

Comments
 (0)