Skip to content

Commit

Permalink
Avoid unnecessary allocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hkratz committed Aug 9, 2021
1 parent c1d0f0a commit 1d4972e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 1d4972e

Please sign in to comment.