chore: fix clippy warnings

This commit is contained in:
Ashhhleyyy 2024-01-20 14:01:42 +00:00
parent a683398ea2
commit 342aa8541c
Signed by: ash
GPG key ID: 83B789081A0878FB
3 changed files with 11 additions and 19 deletions

View file

@ -33,17 +33,11 @@ pub enum ContentType {
impl ContentType { impl ContentType {
pub fn is_season(&self) -> bool { pub fn is_season(&self) -> bool {
match self { matches!(self, ContentType::Season)
ContentType::Season => true,
_ => false,
}
} }
pub fn is_episode(&self) -> bool { pub fn is_episode(&self) -> bool {
match self { matches!(self, ContentType::Episode)
ContentType::Episode => true,
_ => false,
}
} }
} }
@ -176,7 +170,7 @@ impl SubtitleTrack {
".mp4", ".mp4",
&format!(".{}.{}", subtitle.language, subtitle.ext().unwrap()), &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, lang: subtitle.language,
} }
} }

View file

@ -73,10 +73,10 @@ pub fn vidstack_player(
pub fn native_player( pub fn native_player(
title: &str, title: &str,
video_url: &str, video_url: &str,
aspect: &str, _aspect: &str,
poster: &str, _poster: &str,
subtitles: &[SubtitleTrack], subtitles: &[SubtitleTrack],
args: &Args, _args: &Args,
) -> Result<maud::Markup> { ) -> Result<maud::Markup> {
Ok(base_template( Ok(base_template(
title, title,
@ -129,14 +129,12 @@ pub fn tv_show(details: &ItemMeta, args: &Args, children: &[ItemMeta]) -> Result
.seasons { .seasons {
@for child in children { @for child in children {
@if child.ty.is_season() { @if child.ty.is_season() {
@match season_card(&child.data, &child.url, args) { @if let Ok(s) = season_card(&child.data, &child.url, args) {
Ok(s) => (s), (s)
Err(_) => {},
} }
} @else if child.ty.is_episode() { } @else if child.ty.is_episode() {
@match episode_card(&child.data, &child.url, args) { @if let Ok(e) = episode_card(&child.data, &child.url, args) {
Ok(s) => (s), (e)
Err(_) => {},
} }
} }
} }

View file

@ -167,7 +167,7 @@ fn load_contents(path: &Path, content_type: ContentType, args: &Args) -> Result<
ContentType::Episode => unreachable!(), ContentType::Episode => unreachable!(),
}; };
let data = read_data(&path.join(meta_file))?; 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 { let parent = match content_type {
ContentType::TvShow => None, ContentType::TvShow => None,
ContentType::Season => Some(read_data(&path.parent().unwrap().join("tvshow.nfo"))?), ContentType::Season => Some(read_data(&path.parent().unwrap().join("tvshow.nfo"))?),