about summary refs log tree commit diff stats
path: root/src/storage/video_database
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/video_database')
-rw-r--r--src/storage/video_database/downloader.rs8
-rw-r--r--src/storage/video_database/extractor_hash.rs3
-rw-r--r--src/storage/video_database/getters.rs4
3 files changed, 5 insertions, 10 deletions
diff --git a/src/storage/video_database/downloader.rs b/src/storage/video_database/downloader.rs
index bba2b0a..c5490f3 100644
--- a/src/storage/video_database/downloader.rs
+++ b/src/storage/video_database/downloader.rs
@@ -43,11 +43,7 @@ pub async fn get_next_uncached_video(app: &App) -> Result<Option<Video>> {
     } else {
         let base = result?;
 
-        let thumbnail_url = if let Some(url) = &base.thumbnail_url {
-            Some(Url::parse(&url).expect("Parsing this as url should always work"))
-        } else {
-            None
-        };
+        let thumbnail_url = base.thumbnail_url.as_ref().map(|url| Url::parse(url).expect("Parsing this as url should always work"));
 
         let status_change = if base.status_change == 1 {
             true
@@ -57,7 +53,7 @@ pub async fn get_next_uncached_video(app: &App) -> Result<Option<Video>> {
         };
 
         let video = Video {
-            cache_path: base.cache_path.as_ref().map(|val| PathBuf::from(val)),
+            cache_path: base.cache_path.as_ref().map(PathBuf::from),
             description: base.description.clone(),
             duration: base.duration,
             extractor_hash: ExtractorHash::from_hash(
diff --git a/src/storage/video_database/extractor_hash.rs b/src/storage/video_database/extractor_hash.rs
index 09ca2ea..62a9eda 100644
--- a/src/storage/video_database/extractor_hash.rs
+++ b/src/storage/video_database/extractor_hash.rs
@@ -90,7 +90,6 @@ impl ExtractorHash {
             self.hash()
                 .to_hex()
                 .chars()
-                .into_iter()
                 .take(needed_chars)
                 .collect::<String>(),
         ))
@@ -102,7 +101,7 @@ impl ExtractorHash {
         let needed_chars = s.0.len();
 
         for hash in all_hashes {
-            if &hash.to_hex()[..needed_chars] == s.0 {
+            if hash.to_hex()[..needed_chars] == s.0 {
                 return Ok(hash);
             }
         }
diff --git a/src/storage/video_database/getters.rs b/src/storage/video_database/getters.rs
index 176ebbb..f2b0507 100644
--- a/src/storage/video_database/getters.rs
+++ b/src/storage/video_database/getters.rs
@@ -113,7 +113,7 @@ pub async fn get_videos(
             "Failed to query videos with states: '{}'",
             allowed_states.iter().fold(String::new(), |mut acc, state| {
                 acc.push(' ');
-                acc.push_str(&state.as_str());
+                acc.push_str(state.as_str());
                 acc
             }),
         )
@@ -126,7 +126,7 @@ pub async fn get_videos(
                 cache_path: base
                     .get::<Option<String>, &str>("cache_path")
                     .as_ref()
-                    .map(|val| PathBuf::from(val)),
+                    .map(PathBuf::from),
                 description: base.get::<Option<String>, &str>("description").clone(),
                 duration: base.get("duration"),
                 extractor_hash: ExtractorHash::from_hash(