chore: satisfy clippy map_unwrap_or on rust 1.100
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4f283f317c
commit
9f101397d0
@@ -243,8 +243,7 @@ async fn probe_subtitles(state: &AppState) -> SubtitleHealth {
|
||||
// quiet rather than failing on data the operator has not entered yet.
|
||||
let enabled = settings
|
||||
.as_ref()
|
||||
.map(|settings| settings.providers_enabled.as_slice())
|
||||
.unwrap_or_default();
|
||||
.map_or_default(|settings| settings.providers_enabled.as_slice());
|
||||
let engine = settings
|
||||
.as_ref()
|
||||
.and_then(|settings| settings.translation_engine.as_deref());
|
||||
|
||||
@@ -641,10 +641,7 @@ async fn embedded_tracks_of(
|
||||
.fetch_optional(pool(state)?)
|
||||
.await?
|
||||
.flatten();
|
||||
Ok(probed
|
||||
.as_deref()
|
||||
.map(extractable_tracks)
|
||||
.unwrap_or_default())
|
||||
Ok(probed.as_deref().map_or_default(extractable_tracks))
|
||||
}
|
||||
|
||||
/// The `sub_tracks` array of a `probed` blob, filtered to what §15 allows an
|
||||
|
||||
@@ -165,14 +165,13 @@ impl FakeQbit {
|
||||
.torrents()
|
||||
.into_iter()
|
||||
.find(|torrent| torrent.hash.eq_ignore_ascii_case(&hash))
|
||||
.map(|torrent| {
|
||||
.map_or_default(|torrent| {
|
||||
torrent
|
||||
.files
|
||||
.into_iter()
|
||||
.map(|(path, size)| json!({"name": path, "size": size}))
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
});
|
||||
ResponseTemplate::new(200).set_body_json(files)
|
||||
}
|
||||
|
||||
@@ -281,8 +280,7 @@ fn decode(input: &str) -> String {
|
||||
fn text(parts: &HashMap<String, Vec<u8>>, key: &str) -> String {
|
||||
parts
|
||||
.get(key)
|
||||
.map(|bytes| String::from_utf8_lossy(bytes).into_owned())
|
||||
.unwrap_or_default()
|
||||
.map_or_default(|bytes| String::from_utf8_lossy(bytes).into_owned())
|
||||
}
|
||||
|
||||
/// The named parts of a `multipart/form-data` body.
|
||||
|
||||
@@ -787,21 +787,19 @@ impl From<RawVideo> for Video {
|
||||
}
|
||||
|
||||
fn cast_from(raw: Option<RawCredits>) -> Vec<CastMember> {
|
||||
let mut cast: Vec<CastMember> = raw
|
||||
.map(|credits| {
|
||||
credits
|
||||
.cast
|
||||
.into_iter()
|
||||
.map(|member| CastMember {
|
||||
tmdb_id: member.id,
|
||||
name: member.name,
|
||||
character: member.character,
|
||||
profile_path: non_empty(member.profile_path),
|
||||
order: member.order,
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let mut cast: Vec<CastMember> = raw.map_or_default(|credits| {
|
||||
credits
|
||||
.cast
|
||||
.into_iter()
|
||||
.map(|member| CastMember {
|
||||
tmdb_id: member.id,
|
||||
name: member.name,
|
||||
character: member.character,
|
||||
profile_path: non_empty(member.profile_path),
|
||||
order: member.order,
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
// TMDB's own ordering is by `order`; sorting makes the truncation hold
|
||||
// even if a fixture or future API revision sends them shuffled.
|
||||
cast.sort_by_key(|member| member.order);
|
||||
@@ -810,9 +808,8 @@ fn cast_from(raw: Option<RawCredits>) -> Vec<CastMember> {
|
||||
}
|
||||
|
||||
fn trailer_from(raw: Option<RawVideoList>) -> Option<Video> {
|
||||
let videos: Vec<Video> = raw
|
||||
.map(|list| list.results.into_iter().map(Into::into).collect())
|
||||
.unwrap_or_default();
|
||||
let videos: Vec<Video> =
|
||||
raw.map_or_default(|list| list.results.into_iter().map(Into::into).collect());
|
||||
select_trailer(&videos)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user