Skip to content

Commit

Permalink
Use Option::map_or instead of open coding it
Browse files Browse the repository at this point in the history
  • Loading branch information
LingMan committed Oct 12, 2021
1 parent 9475e60 commit 7943c9c
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 7943c9c

Please sign in to comment.