From 4420fd25c82f3e3aa4e35eb34f4a5f4a45b68e17 Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Mon, 31 Jan 2022 01:43:13 +0100 Subject: [PATCH] perf: Merge .clone() calls This seems like something rustc would be able to figure out, but apparently not. Saves 0.6K. --- src/parse/arg_matcher.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/parse/arg_matcher.rs b/src/parse/arg_matcher.rs index 8c3bc51f..3bd13d19 100644 --- a/src/parse/arg_matcher.rs +++ b/src/parse/arg_matcher.rs @@ -63,13 +63,14 @@ impl ArgMatcher { // --global-arg where the value is `other`, however the occurs will be 0. let to_update = if let Some(parent_ma) = vals_map.get(global_arg) { if parent_ma.occurs > 0 && ma.occurs == 0 { - parent_ma.clone() + parent_ma } else { - ma.clone() + ma } } else { - ma.clone() - }; + ma + } + .clone(); vals_map.insert(global_arg.clone(), to_update); } }