From 58679c929e3e430bd037cb20bc3bd0d77b60183c Mon Sep 17 00:00:00 2001 From: Til Blechschmidt Date: Fri, 5 Mar 2021 15:14:14 +0100 Subject: [PATCH] :rotating_light: Fix linter warnings --- core/src/libraries/lifecycle/heart.rs | 4 ++-- core/src/libraries/scheduling/job_scheduler.rs | 16 ++++++++-------- core/src/libraries/storage/scan.rs | 7 ++----- core/src/libraries/storage/storage_handler.rs | 5 +---- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/core/src/libraries/lifecycle/heart.rs b/core/src/libraries/lifecycle/heart.rs index 14feb948..cc8546eb 100644 --- a/core/src/libraries/lifecycle/heart.rs +++ b/core/src/libraries/lifecycle/heart.rs @@ -123,8 +123,8 @@ impl Heart { pin_mut!(sigterm, ctrl_c); select! { - _ = sigterm => (), - _ = ctrl_c => (), + _ = sigterm => {}, + _ = ctrl_c => {}, }; } diff --git a/core/src/libraries/scheduling/job_scheduler.rs b/core/src/libraries/scheduling/job_scheduler.rs index 9ea5c9a1..2aaaba44 100644 --- a/core/src/libraries/scheduling/job_scheduler.rs +++ b/core/src/libraries/scheduling/job_scheduler.rs @@ -51,14 +51,14 @@ impl fmt::Display for JobStatus { impl PartialEq for JobStatus { fn eq(&self, other: &Self) -> bool { - match (self, other) { - (&JobStatus::Startup, &JobStatus::Startup) => true, - (&JobStatus::Restarting, &JobStatus::Restarting) => true, - (&JobStatus::CrashLoopBackOff, &JobStatus::CrashLoopBackOff) => true, - (&JobStatus::Terminated, &JobStatus::Terminated) => true, - (&JobStatus::Ready(_), &JobStatus::Ready(_)) => true, - _ => false, - } + matches!( + (self, other), + (&JobStatus::Startup, &JobStatus::Startup) + | (&JobStatus::Restarting, &JobStatus::Restarting) + | (&JobStatus::CrashLoopBackOff, &JobStatus::CrashLoopBackOff) + | (&JobStatus::Terminated, &JobStatus::Terminated) + | (&JobStatus::Ready(_), &JobStatus::Ready(_)) + ) } } diff --git a/core/src/libraries/storage/scan.rs b/core/src/libraries/storage/scan.rs index 2edf7deb..def9c4f2 100644 --- a/core/src/libraries/storage/scan.rs +++ b/core/src/libraries/storage/scan.rs @@ -102,11 +102,8 @@ impl FileSystemScanner { } async fn process_stream(&self, mut stream: ReadDir) { - while let Ok(entry) = stream.next_entry().await { - match entry { - None => break, - Some(entry) => self.process_entry(entry).await, - } + while let Ok(Some(entry)) = stream.next_entry().await { + self.process_entry(entry).await } } diff --git a/core/src/libraries/storage/storage_handler.rs b/core/src/libraries/storage/storage_handler.rs index c4565a4d..ad8f24ac 100644 --- a/core/src/libraries/storage/storage_handler.rs +++ b/core/src/libraries/storage/storage_handler.rs @@ -100,10 +100,7 @@ impl StorageHandler { let transaction = self.pool.begin().await?; let scanner = scan::FileSystemScanner::new(transaction, root); - let resulting_transaction = scanner - .scan() - .await - .ok_or_else(|| StorageError::InternalError)?; + let resulting_transaction = scanner.scan().await.ok_or(StorageError::InternalError)?; resulting_transaction.commit().await?;