Skip to content
This repository has been archived by the owner on Aug 6, 2019. It is now read-only.

Commit

Permalink
Resolve a final Clippy warning
Browse files Browse the repository at this point in the history
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 <kristofer.rye@gmail.com>
Tested-by: Kristofer Rye <kristofer.rye@gmail.com>
  • Loading branch information
rye committed Apr 15, 2019
1 parent 7f80ccf commit f2fcee8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f2fcee8

Please sign in to comment.