mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Use Option::map_or instead of open coding it
This commit is contained in:
parent
9475e609b8
commit
7943c9c446
@ -841,7 +841,7 @@ impl<T: Idx> GrowableBitSet<T> {
|
||||
#[inline]
|
||||
pub fn contains(&self, elem: T) -> bool {
|
||||
let (word_index, mask) = word_index_and_mask(elem);
|
||||
if let Some(word) = self.bit_set.words.get(word_index) { (word & mask) != 0 } else { false }
|
||||
self.bit_set.words.get(word_index).map_or(false, |word| (word & mask) != 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user