Skip to content

Commit 94d2c04

Browse files
committed
cleanup: address two Clippy unnecessary_unwrap warnings
1 parent 335e76f commit 94d2c04

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/src/default_index/mutable.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,14 @@ impl MutableCommitIndexSegment {
346346
squashed
347347
}
348348

349-
pub(super) fn save_in(self, dir: &Path) -> Result<Arc<ReadonlyCommitIndexSegment>, PathError> {
350-
if self.num_local_commits() == 0 && self.parent_file.is_some() {
351-
return Ok(self.parent_file.unwrap());
349+
pub(super) fn save_in(
350+
mut self,
351+
dir: &Path,
352+
) -> Result<Arc<ReadonlyCommitIndexSegment>, PathError> {
353+
if self.num_local_commits() == 0
354+
&& let Some(parent_file) = self.parent_file.take()
355+
{
356+
return Ok(parent_file);
352357
}
353358

354359
let mut buf = Vec::new();

lib/src/stacked_table.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,11 @@ impl MutableTable {
331331
squashed
332332
}
333333

334-
fn save_in(self, store: &TableStore) -> TableStoreResult<Arc<ReadonlyTable>> {
335-
if self.entries.is_empty() && self.parent_file.is_some() {
336-
return Ok(self.parent_file.unwrap());
334+
fn save_in(mut self, store: &TableStore) -> TableStoreResult<Arc<ReadonlyTable>> {
335+
if self.entries.is_empty()
336+
&& let Some(parent_file) = self.parent_file.take()
337+
{
338+
return Ok(parent_file);
337339
}
338340

339341
let buf = self.maybe_squash_with_ancestors().serialize();

0 commit comments

Comments
 (0)