Rollup merge of #89818 - LingMan:map_or, r=oli-obk

Use Option::map_or instead of open coding it

````@rustbot```` modify labels +C-cleanup +T-compiler
This commit is contained in:
Yuki Okushi 2021-10-13 21:55:17 +09:00 committed by GitHub
commit 6eb0a5f0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}