Use ? rather than if let

This commit is contained in:
Gwilym Inzani 2023-05-09 21:39:35 +01:00
parent 9205ba1d0d
commit b3e56e88f2

View file

@ -146,12 +146,10 @@ impl<K, V, ALLOCATOR: ClonableAllocator> NodeStorage<K, V, ALLOCATOR> {
);
let node = &self.nodes[location];
if let Some(node_key_ref) = node.key_ref() {
if node_key_ref.borrow() == key {
return Some(location);
}
} else {
return None;
let node_key_ref = node.key_ref()?;
if node_key_ref.borrow() == key {
return Some(location);
}
}