about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-10-13 21:55:17 +0900
committerGitHub <noreply@github.com>2021-10-13 21:55:17 +0900
commit6eb0a5f0e88757cb5dc8733dfc9ae47219401201 (patch)
treea4eee3ae9b301728eb4d8a6d3ead737d68c1ec24
parent59ebfdd7e014c7c9adff21b8d0051408c172b375 (diff)
parent7943c9c44672e0d469e4fd8f83c238ca73becb71 (diff)
downloadrust-6eb0a5f0e88757cb5dc8733dfc9ae47219401201.tar.gz
rust-6eb0a5f0e88757cb5dc8733dfc9ae47219401201.zip
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
-rw-r--r--compiler/rustc_index/src/bit_set.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs
index 1995fd64e6f..573124c8ec9 100644
--- a/compiler/rustc_index/src/bit_set.rs
+++ b/compiler/rustc_index/src/bit_set.rs
@@ -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)
     }
 }