mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
trans_fn: Use replace() instead of new() + swap()
This commit is contained in:
+1
-2
@@ -20,8 +20,7 @@ pub(crate) fn trans_fn<'tcx, B: Backend + 'static>(
|
||||
let mut func_ctx = FunctionBuilderContext::new();
|
||||
cx.cached_context.clear();
|
||||
|
||||
let mut func = Function::new();
|
||||
std::mem::swap(&mut cx.cached_context.func, &mut func);
|
||||
let mut func = std::mem::replace(&mut cx.cached_context.func, Function::new());
|
||||
func.name = ExternalName::user(0, func_id.as_u32());
|
||||
func.signature = sig;
|
||||
func.collect_debug_info();
|
||||
|
||||
Reference in New Issue
Block a user