Fix building on Rust 1.37

It doesn't like by-move pattern with an `if`
This commit is contained in:
Dzmitry Malyshau 2020-01-22 19:48:32 -05:00
parent c59e35e9cb
commit b9e7449b43

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,
}