diff --git a/candle-core/src/strided_index.rs b/candle-core/src/strided_index.rs index 9354e8ea3..92734b844 100644 --- a/candle-core/src/strided_index.rs +++ b/candle-core/src/strided_index.rs @@ -36,10 +36,7 @@ impl Iterator for StridedIndex<'_> { type Item = usize; fn next(&mut self) -> Option { - let storage_index = match self.next_storage_index { - None => return None, - Some(storage_index) => storage_index, - }; + let storage_index = self.next_storage_index?; let mut updated = false; let mut next_storage_index = storage_index; for ((multi_i, max_i), stride_i) in self diff --git a/candle-nn/src/var_builder.rs b/candle-nn/src/var_builder.rs index ba410e4ea..cce605080 100644 --- a/candle-nn/src/var_builder.rs +++ b/candle-nn/src/var_builder.rs @@ -350,7 +350,7 @@ impl SimpleBackend for candle::npy::NpzTensors { } fn contains_tensor(&self, name: &str) -> bool { - self.get(name).map_or(false, |v| v.is_some()) + self.get(name).is_ok_and(|v| v.is_some()) } } @@ -383,7 +383,7 @@ impl SimpleBackend for candle::pickle::PthTensors { } fn contains_tensor(&self, name: &str) -> bool { - self.get(name).map_or(false, |v| v.is_some()) + self.get(name).is_ok_and(|v| v.is_some()) } }