fix clippy warnings

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-24 14:39:00 +08:00
parent 4d676a451a
commit 0d995dff19
9 changed files with 50 additions and 51 deletions

View File

@@ -51,13 +51,13 @@ impl CompactionController {
pub fn generate_compaction_task(&self, snapshot: &LsmStorageState) -> Option<CompactionTask> {
match self {
CompactionController::Leveled(ctrl) => ctrl
.generate_compaction_task(&snapshot)
.generate_compaction_task(snapshot)
.map(CompactionTask::Leveled),
CompactionController::Simple(ctrl) => ctrl
.generate_compaction_task(&snapshot)
.generate_compaction_task(snapshot)
.map(CompactionTask::Simple),
CompactionController::Tiered(ctrl) => ctrl
.generate_compaction_task(&snapshot)
.generate_compaction_task(snapshot)
.map(CompactionTask::Tiered),
CompactionController::NoCompaction => unreachable!(),
}
@@ -71,13 +71,13 @@ impl CompactionController {
) -> (LsmStorageState, Vec<usize>) {
match (self, task) {
(CompactionController::Leveled(ctrl), CompactionTask::Leveled(task)) => {
ctrl.apply_compaction_result(&snapshot, task, output)
ctrl.apply_compaction_result(snapshot, task, output)
}
(CompactionController::Simple(ctrl), CompactionTask::Simple(task)) => {
ctrl.apply_compaction_result(&snapshot, task, output)
ctrl.apply_compaction_result(snapshot, task, output)
}
(CompactionController::Tiered(ctrl), CompactionTask::Tiered(task)) => {
ctrl.apply_compaction_result(&snapshot, task, output)
ctrl.apply_compaction_result(snapshot, task, output)
}
_ => unreachable!(),
}
@@ -86,11 +86,10 @@ impl CompactionController {
impl CompactionController {
pub fn flush_to_l0(&self) -> bool {
if let Self::Leveled(_) | Self::Simple(_) | Self::NoCompaction = self {
true
} else {
false
}
matches!(
self,
Self::Leveled(_) | Self::Simple(_) | Self::NoCompaction
)
}
}
@@ -164,6 +163,6 @@ impl LsmStorageInner {
}
}
});
return Ok(Some(handle));
Ok(Some(handle))
}
}