From f2fcee8c7fab18681f57eeeba4fce936f54200e5 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Mon, 15 Apr 2019 10:23:07 -0500 Subject: [PATCH] Resolve a final Clippy warning Here we needed to revise the code so that the initial evaluation of the mutable borrow always comes after each use of the shared borrow that it conflicts with. In this case, this just meant that I needed to pull the value out of the function call, so that the calculation of the value passed into plugins.replace was computed _strictly_ before the call began? Something like that. This is in relation to rust-lang/rust#59159, which is effectively going to remove two-phase borrows in this context. Signed-off-by: Kristofer Rye Tested-by: Kristofer Rye --- src/dump.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dump.rs b/src/dump.rs index 948f8f8..ddf4dd9 100644 --- a/src/dump.rs +++ b/src/dump.rs @@ -49,10 +49,11 @@ impl Dump { if let Some(plugin) = plugins.get(&record_plugin) { if !plugin.cve.contains(record_plugin.cve.first().unwrap()) { - plugins.replace(Plugin { + let replacement = Plugin { cve: [plugin.cve.as_slice(), record_plugin.cve.as_slice()].concat(), ..(plugin.clone()) - }); + }; + plugins.replace(replacement); } } else { assert_eq!(plugins.insert(record_plugin.clone()), true);