From 7943c9c44672e0d469e4fd8f83c238ca73becb71 Mon Sep 17 00:00:00 2001 From: LingMan Date: Tue, 12 Oct 2021 14:47:31 +0200 Subject: [PATCH] Use Option::map_or instead of open coding it --- compiler/rustc_index/src/bit_set.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 GrowableBitSet { #[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) } }