From 342aa8541c59c8a28d7617bc85409439e006c833 Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Sat, 20 Jan 2024 14:01:42 +0000 Subject: [PATCH] chore: fix clippy warnings --- src/nfo.rs | 12 +++--------- src/templates.rs | 16 +++++++--------- src/walker.rs | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/nfo.rs b/src/nfo.rs index abdb01c..e825c98 100644 --- a/src/nfo.rs +++ b/src/nfo.rs @@ -33,17 +33,11 @@ pub enum ContentType { impl ContentType { pub fn is_season(&self) -> bool { - match self { - ContentType::Season => true, - _ => false, - } + matches!(self, ContentType::Season) } pub fn is_episode(&self) -> bool { - match self { - ContentType::Episode => true, - _ => false, - } + matches!(self, ContentType::Episode) } } @@ -176,7 +170,7 @@ impl SubtitleTrack { ".mp4", &format!(".{}.{}", subtitle.language, subtitle.ext().unwrap()), ), - label: Self::label_from_lang(&subtitle.language).to_string(), + label: Self::label_from_lang(&subtitle.language), lang: subtitle.language, } } diff --git a/src/templates.rs b/src/templates.rs index 26fe08b..9ba2cb1 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -73,10 +73,10 @@ pub fn vidstack_player( pub fn native_player( title: &str, video_url: &str, - aspect: &str, - poster: &str, + _aspect: &str, + _poster: &str, subtitles: &[SubtitleTrack], - args: &Args, + _args: &Args, ) -> Result { Ok(base_template( title, @@ -129,14 +129,12 @@ pub fn tv_show(details: &ItemMeta, args: &Args, children: &[ItemMeta]) -> Result .seasons { @for child in children { @if child.ty.is_season() { - @match season_card(&child.data, &child.url, args) { - Ok(s) => (s), - Err(_) => {}, + @if let Ok(s) = season_card(&child.data, &child.url, args) { + (s) } } @else if child.ty.is_episode() { - @match episode_card(&child.data, &child.url, args) { - Ok(s) => (s), - Err(_) => {}, + @if let Ok(e) = episode_card(&child.data, &child.url, args) { + (e) } } } diff --git a/src/walker.rs b/src/walker.rs index 2017977..95be300 100644 --- a/src/walker.rs +++ b/src/walker.rs @@ -167,7 +167,7 @@ fn load_contents(path: &Path, content_type: ContentType, args: &Args) -> Result< ContentType::Episode => unreachable!(), }; let data = read_data(&path.join(meta_file))?; - let url = get_url(&path.to_string_lossy().to_owned(), args)?; + let url = get_url(&path.to_string_lossy(), args)?; let parent = match content_type { ContentType::TvShow => None, ContentType::Season => Some(read_data(&path.parent().unwrap().join("tvshow.nfo"))?),