about summary refs log tree commit diff stats
path: root/src/select
diff options
context:
space:
mode:
Diffstat (limited to 'src/select')
-rw-r--r--src/select/cmds.rs12
-rw-r--r--src/select/mod.rs4
-rw-r--r--src/select/selection_file/display.rs2
-rw-r--r--src/select/selection_file/mod.rs2
4 files changed, 8 insertions, 12 deletions
diff --git a/src/select/cmds.rs b/src/select/cmds.rs
index 2b36fe8..31589f2 100644
--- a/src/select/cmds.rs
+++ b/src/select/cmds.rs
@@ -36,10 +36,10 @@ pub async fn handle_select_cmd(
             handle_status_change(app, shared, line_number, VideoStatus::Watched).await?;
         }
         SelectCommand::Watch { shared } => {
-            let hash = shared.hash.clone().realize(&app).await?;
+            let hash = shared.hash.clone().realize(app).await?;
 
             let video = get_video_by_hash(app, &hash).await?;
-            if let Some(_) = video.cache_path {
+            if video.cache_path.is_some() {
                 handle_status_change(app, shared, line_number, VideoStatus::Cached).await?;
             } else {
                 handle_status_change(app, shared, line_number, VideoStatus::Watch).await?;
@@ -63,7 +63,7 @@ async fn handle_status_change(
     line_number: Option<i64>,
     new_status: VideoStatus,
 ) -> Result<()> {
-    let hash = shared.hash.realize(&app).await?;
+    let hash = shared.hash.realize(app).await?;
     let video_options = VideoOptions::new(
         shared
             .subtitle_langs
@@ -81,9 +81,5 @@ async fn handle_status_change(
 fn compute_priority(line_number: Option<i64>, priority: Option<i64>) -> Option<i64> {
     if let Some(pri) = priority {
         Some(pri)
-    } else if let Some(pri) = line_number {
-        Some(pri)
-    } else {
-        None
-    }
+    } else { line_number }
 }
diff --git a/src/select/mod.rs b/src/select/mod.rs
index 695e7ed..2663a04 100644
--- a/src/select/mod.rs
+++ b/src/select/mod.rs
@@ -62,7 +62,7 @@ pub async fn select(app: &App, done: bool, use_last_selection: bool) -> Result<(
 
         // Warmup the cache for the display rendering of the videos.
         // Otherwise the futures would all try to warm it up at the same time.
-        if let Some(vid) = matching_videos.get(0) {
+        if let Some(vid) = matching_videos.first() {
             let _ = vid.to_select_file_display(app).await?;
         }
 
@@ -136,7 +136,7 @@ pub async fn select(app: &App, done: bool, use_last_selection: bool) -> Result<(
             };
 
             handle_select_cmd(
-                &app,
+                app,
                 cmd.expect("This value should always be some here"),
                 Some(line_number),
             )
diff --git a/src/select/selection_file/display.rs b/src/select/selection_file/display.rs
index 1f4e09b..8ff6a15 100644
--- a/src/select/selection_file/display.rs
+++ b/src/select/selection_file/display.rs
@@ -32,7 +32,7 @@ impl Video {
 
         let opts = get_video_opts(app, &self.extractor_hash)
             .await?
-            .to_cli_flags(&app);
+            .to_cli_flags(app);
         let opts_white = if !opts.is_empty() { " " } else { "" };
 
         let publish_date = if let Some(date) = self.publish_date {
diff --git a/src/select/selection_file/mod.rs b/src/select/selection_file/mod.rs
index bdb0866..d228023 100644
--- a/src/select/selection_file/mod.rs
+++ b/src/select/selection_file/mod.rs
@@ -28,7 +28,7 @@ pub fn process_line(line: &str) -> Result<Option<Vec<String>>> {
 
         let mut vec = Vec::with_capacity(tri.arguments().len() + 1);
         vec.push(tri.command().to_owned());
-        vec.extend(tri.arguments().to_vec().into_iter());
+        vec.extend(tri.arguments().to_vec());
 
         Ok(Some(vec))
     }