chore: fix clippy lints

This commit is contained in:
ThetaDev 2024-01-18 13:23:56 +01:00
parent 11fe9a5fa1
commit 9ecf7eff74
No known key found for this signature in database
GPG key ID: 649CA4EBDC338394
4 changed files with 11 additions and 8 deletions

View file

@ -529,7 +529,7 @@ fn map_channel_content(
.content
.section_list_renderer
.as_ref()
.and_then(|c| c.contents.c.get(0))
.and_then(|c| c.contents.c.first())
{
return Err(ExtractionError::Unavailable {
reason: crate::error::UnavailabilityReason::AgeRestricted,

View file

@ -327,7 +327,7 @@ impl MapResponse<MusicAlbum> for response::MusicPlaylist {
let year_txt = subtitle_split
.swap_remove(2)
.0
.get(0)
.first()
.map(|c| c.as_str().to_owned());
(year_txt, subtitle_split.try_swap_remove(1))
}

View file

@ -335,12 +335,14 @@ impl From<Thumbnails> for Vec<crate::model::Thumbnail> {
impl From<Vec<ChannelBadge>> for crate::model::Verification {
fn from(badges: Vec<ChannelBadge>) -> Self {
badges.get(0).map_or(crate::model::Verification::None, |b| {
match b.metadata_badge_renderer.style {
ChannelBadgeStyle::BadgeStyleTypeVerified => Self::Verified,
ChannelBadgeStyle::BadgeStyleTypeVerifiedArtist => Self::Artist,
}
})
badges
.first()
.map_or(crate::model::Verification::None, |b| {
match b.metadata_badge_renderer.style {
ChannelBadgeStyle::BadgeStyleTypeVerified => Self::Verified,
ChannelBadgeStyle::BadgeStyleTypeVerifiedArtist => Self::Artist,
}
})
}
}

View file

@ -3,6 +3,7 @@
#![allow(
clippy::doc_markdown,
clippy::similar_names,
clippy::struct_field_names,
clippy::items_after_statements,
clippy::too_many_lines,
clippy::module_name_repetitions,