From b6fd034ddf2207d4c3ecd0499b7ad6c186093042 Mon Sep 17 00:00:00 2001 From: Folkert Date: Wed, 2 Mar 2022 14:54:25 +0100 Subject: [PATCH] remove clones --- compiler/can/src/def.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler/can/src/def.rs b/compiler/can/src/def.rs index cfea20715c..5503999719 100644 --- a/compiler/can/src/def.rs +++ b/compiler/can/src/def.rs @@ -765,10 +765,8 @@ fn group_to_declaration( if cycle.len() == 1 { let symbol = &cycle[0]; - match can_defs_by_symbol.get(symbol) { - Some(can_def) => { - let mut new_def = can_def.clone(); - + match can_defs_by_symbol.remove(symbol) { + Some(mut new_def) => { // Determine recursivity of closures that are not tail-recursive if let Closure(ClosureData { recursive: recursive @ Recursive::NotRecursive, @@ -796,10 +794,8 @@ fn group_to_declaration( // Topological sort gives us the reverse of the sorting we want! for symbol in cycle.into_iter().rev() { - match can_defs_by_symbol.get(&symbol) { - Some(can_def) => { - let mut new_def = can_def.clone(); - + match can_defs_by_symbol.remove(&symbol) { + Some(mut new_def) => { // Determine recursivity of closures that are not tail-recursive if let Closure(ClosureData { recursive: recursive @ Recursive::NotRecursive,