From 8c4cebfe69fb1a4b7ea1615f363504f551e842f0 Mon Sep 17 00:00:00 2001
From: Volkor <me@volkor.me>
Date: Wed, 28 Jun 2023 00:36:08 +1000
Subject: [PATCH] fix: cleaning up a few clippy warnings

---
 src/handlers/list_files.rs | 11 +++++------
 src/handlers/mod.rs        |  4 +---
 src/main.rs                |  4 ++--
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/handlers/list_files.rs b/src/handlers/list_files.rs
index f3de33b..1821365 100644
--- a/src/handlers/list_files.rs
+++ b/src/handlers/list_files.rs
@@ -44,13 +44,12 @@ pub async fn list_files(req: &mut Request, res: &mut Response) {
                 let human_time = convert_unix_timestamp(f.expiry);
 
                 // If isDeleted, change colour to red, else green
-                let mut colour: String = String::new();
-                if f.is_deleted {
-                    colour = "background-color: #ff00000a;".to_string()
+                let colour = if f.is_deleted {
+                    "background-color: #ff00000a;".to_string()
                 } else {
-                    colour = "background-color: #00ff100a;".to_string()
-                }
-
+                    "background-color: #00ff100a;".to_string()
+                };
+                
                 // Add a new file to the rendered string
                 html.push_str(&format!("<tr style='{}'><td><a href={}>{}</a></td><td data-sort='{}'>{}</td><td>{}</td><td>{}</td><td data-sort='{}'>{}</td></tr>",
                     colour,
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 4a95b8d..c7167d7 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -195,9 +195,7 @@ fn convert_unix_timestamp(unix_timestamp: i64) -> String {
         Utc,
     );
 
-    let relative_date = datetime.humanize();
-
-    relative_date.to_string()
+    datetime.humanize()
 }
 
 /// Calculate the number of files in the FileMetric result
diff --git a/src/main.rs b/src/main.rs
index 0e40896..16d72a1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -80,10 +80,10 @@ async fn main() {
     let db_url = &CONFIG.database.url;
 
     // Match on the database type
-    match DatabaseType::from_str(&sql_backend) {
+    match DatabaseType::from_str(sql_backend) {
         Some(DatabaseType::Sqlite) => {
             tracing::info!("Using SQLite backend");
-            let pool = SqlitePool::connect(&db_url).await.unwrap();
+            let pool = SqlitePool::connect(db_url).await.unwrap();
             SQLITE.set(pool).unwrap();
         }
         Some(DatabaseType::Postgres) => {
-- 
GitLab