refactor: Refactored several usages of sort_by_key and match guards to utilize newer Rust version APIs
This commit is contained in:
@@ -83,7 +83,7 @@ impl Network<'_, '_> {
|
||||
Route::Radarr(ActiveRadarrBlock::BlocklistSortPrompt, _)
|
||||
) {
|
||||
let mut blocklist_vec = blocklist_resp.records;
|
||||
blocklist_vec.sort_by(|a, b| a.id.cmp(&b.id));
|
||||
blocklist_vec.sort_by_key(|a| a.id);
|
||||
app.data.radarr_data.blocklist.set_items(blocklist_vec);
|
||||
app.data.radarr_data.blocklist.apply_sorting_toggle(false);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ impl Network<'_, '_> {
|
||||
app.get_current_route(),
|
||||
Route::Radarr(ActiveRadarrBlock::CollectionsSortPrompt, _)
|
||||
) {
|
||||
collections_vec.sort_by(|a, b| a.id.cmp(&b.id));
|
||||
collections_vec.sort_by_key(|a| a.id);
|
||||
app.data.radarr_data.collections.set_items(collections_vec);
|
||||
app.data.radarr_data.collections.apply_sorting_toggle(false);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Network<'_, '_> {
|
||||
Route::Radarr(ActiveRadarrBlock::HistorySortPrompt, _)
|
||||
) {
|
||||
let mut history_vec = history_response.records;
|
||||
history_vec.sort_by(|a, b| a.id.cmp(&b.id));
|
||||
history_vec.sort_by_key(|a| a.id);
|
||||
app.data.radarr_data.history.set_items(history_vec);
|
||||
app.data.radarr_data.history.apply_sorting_toggle(false);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ impl Network<'_, '_> {
|
||||
app.get_current_route(),
|
||||
Route::Radarr(ActiveRadarrBlock::MoviesSortPrompt, _)
|
||||
) {
|
||||
movie_vec.sort_by(|a, b| a.id.cmp(&b.id));
|
||||
movie_vec.sort_by_key(|a| a.id);
|
||||
app.data.radarr_data.movies.set_items(movie_vec);
|
||||
app.data.radarr_data.movies.apply_sorting_toggle(false);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ impl Network<'_, '_> {
|
||||
let log_lines = logs
|
||||
.into_iter()
|
||||
.map(|log| {
|
||||
if log.exception.is_some() {
|
||||
if let Some(exception) = log.exception {
|
||||
HorizontallyScrollableText::from(format!(
|
||||
"{}|{}|{}|{}|{}",
|
||||
log.time,
|
||||
@@ -80,10 +80,7 @@ impl Network<'_, '_> {
|
||||
.exception_type
|
||||
.as_ref()
|
||||
.expect("exception_type must exist when exception is present"),
|
||||
log
|
||||
.exception
|
||||
.as_ref()
|
||||
.expect("exception must exist in this branch")
|
||||
exception
|
||||
))
|
||||
} else {
|
||||
HorizontallyScrollableText::from(format!(
|
||||
|
||||
Reference in New Issue
Block a user