470: Fix building on Rust 1.37 r=kvark a=kvark

It doesn't like by-move pattern with an `if`

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot] 2020-01-23 05:52:38 +00:00 committed by GitHub
commit 61d9e87c6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,10 +216,14 @@ impl<S: ResourceState> ResourceTracker<S> {
let (index, epoch, backend) = id.unzip();
debug_assert_eq!(backend, self.backend);
match self.map.entry(index) {
Entry::Occupied(e) if e.get().ref_count.load() == 1 => {
let res = e.remove();
assert_eq!(res.epoch, epoch);
true
Entry::Occupied(e) => {
if e.get().ref_count.load() == 1 {
let res = e.remove();
assert_eq!(res.epoch, epoch);
true
} else {
false
}
}
_ => false,
}