refactor: replace try_swap_remove
This commit is contained in:
parent
0008e305c2
commit
29ad2f99d4
9 changed files with 87 additions and 61 deletions
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
text::{Text, TextComponents},
|
||||
MapResult,
|
||||
},
|
||||
util::{self, dictionary, TryRemove},
|
||||
util::{self, dictionary},
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
|
@ -587,14 +587,14 @@ impl MusicListMapper {
|
|||
}
|
||||
}
|
||||
// Playlist item
|
||||
FlexColumnDisplayStyle::Default => {
|
||||
let mut fixed_columns = item.fixed_columns;
|
||||
(
|
||||
c2.map(TextComponents::from),
|
||||
c3.map(TextComponents::from),
|
||||
fixed_columns.try_swap_remove(0).map(TextComponents::from),
|
||||
)
|
||||
}
|
||||
FlexColumnDisplayStyle::Default => (
|
||||
c2.map(TextComponents::from),
|
||||
c3.map(TextComponents::from),
|
||||
item.fixed_columns
|
||||
.into_iter()
|
||||
.next()
|
||||
.map(TextComponents::from),
|
||||
),
|
||||
};
|
||||
|
||||
let duration =
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ impl<T> YouTubeListMapper<T> {
|
|||
is_upcoming: video.upcoming_event_data.is_some(),
|
||||
short_description: video
|
||||
.detailed_metadata_snippets
|
||||
.and_then(|mut snippets| snippets.try_swap_remove(0).map(|s| s.snippet_text))
|
||||
.and_then(|snippets| snippets.into_iter().next().map(|s| s.snippet_text))
|
||||
.or(video.description_snippet),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue