Avoid unnecessary allocation.

This commit is contained in:
Hans Kratz 2021-08-09 12:59:23 +00:00
parent c1d0f0a65c
commit 1d4972e0e9

View File

@ -150,8 +150,8 @@ fn struct_llfields<'a, 'tcx>(
} else {
debug!("struct_llfields: offset: {:?} stride: {:?}", offset, layout.size);
}
(result, packed, padding_used.then_some(Box::new(field_remapping)))
let field_remapping = if padding_used { Some(Box::new(field_remapping)) } else { None };
(result, packed, field_remapping)
}
impl<'a, 'tcx> CodegenCx<'a, 'tcx> {