diff options
| author | CohenArthur <arthur.cohen@epita.fr> | 2020-08-22 19:03:35 +0200 |
|---|---|---|
| committer | CohenArthur <arthur.cohen@epita.fr> | 2020-08-22 19:03:35 +0200 |
| commit | 05797b2476401d53b724286f5ad4e28cd08c816f (patch) | |
| tree | 84eb362d718962edbbda12178145217403a0a079 /src | |
| parent | d65e500394640a042e03abe47c511e7d0049f523 (diff) | |
| download | rust-05797b2476401d53b724286f5ad4e28cd08c816f.tar.gz rust-05797b2476401d53b724286f5ad4e28cd08c816f.zip | |
trans_fn: Use replace() instead of new() + swap()
Diffstat (limited to 'src')
| -rw-r--r-- | src/base.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/base.rs b/src/base.rs index bbf5031660b..86ba6ab114d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -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(); |
