Skip to content

Commit

Permalink
Rollup merge of rust-lang#89818 - LingMan:map_or, r=oli-obk
Browse files Browse the repository at this point in the history
Use Option::map_or instead of open coding it

```@rustbot``` modify labels +C-cleanup +T-compiler
  • Loading branch information
the8472 authored Oct 13, 2021
2 parents 626dd87 + 7943c9c commit 67f3a5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_index/src/bit_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 67f3a5f

Please sign in to comment.