about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database/file/mod.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index 53dea04..853240a 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -5,9 +5,6 @@ use tokio::fs::{File, OpenOptions};
 use tokio::io::{AsyncReadExt, AsyncWriteExt};
 use tokio::task::spawn_blocking;
 use async_trait::async_trait;
-/*use futures_util::stream;
-use futures_util::StreamExt;
-use futures_util::TryStreamExt;*/
 use futures::{stream, StreamExt, TryStreamExt};
 use log::debug;
 use serde_json::json;
@@ -111,7 +108,7 @@ fn url_to_path(root: &Path, url: &str) -> PathBuf {
 fn url_to_relative_path(url: &str) -> relative_path::RelativePathBuf {
     let url = warp::http::Uri::try_from(url).expect("Couldn't parse a URL");
     let mut path = relative_path::RelativePathBuf::new();
-    path.push(url.authority().unwrap().to_string() + &url.path().to_string() + ".json");
+    path.push(url.authority().unwrap().to_string() + url.path() + ".json");
 
     path
 }
@@ -402,12 +399,11 @@ impl Storage for FileStorage {
             let mut content = String::new();
             file.read_to_string(&mut content).await?;
             drop(file);
-            let mut channels: Vec<super::MicropubChannel>;
-            if !content.is_empty() {
-                channels = serde_json::from_str(&content)?;
+            let mut channels: Vec<super::MicropubChannel> = if !content.is_empty() {
+                serde_json::from_str(&content)?
             } else {
-                channels = Vec::default();
-            }
+                Vec::default()
+            };
 
             channels.push(super::MicropubChannel {
                 uid: key.to_string(),
@@ -614,6 +610,6 @@ impl Storage for FileStorage {
         tempfile.write_all(serde_json::to_string(&settings)?.as_bytes()).await?;
         drop(tempfile);
         tokio::fs::rename(temppath, path).await?;
-        Result::Ok(())
+        Ok(())
     }
 }