1
Fork 0

trans_fn: Use replace() instead of new() + swap()

This commit is contained in:
CohenArthur 2020-08-22 19:03:35 +02:00
parent d65e500394
commit 05797b2476

View file

@ -20,8 +20,7 @@ pub(crate) fn trans_fn<'tcx, B: Backend + 'static>(
let mut func_ctx = FunctionBuilderContext::new(); let mut func_ctx = FunctionBuilderContext::new();
cx.cached_context.clear(); cx.cached_context.clear();
let mut func = Function::new(); let mut func = std::mem::replace(&mut cx.cached_context.func, Function::new());
std::mem::swap(&mut cx.cached_context.func, &mut func);
func.name = ExternalName::user(0, func_id.as_u32()); func.name = ExternalName::user(0, func_id.as_u32());
func.signature = sig; func.signature = sig;
func.collect_debug_info(); func.collect_debug_info();