From 63a2bf7232f078b0c692c9dbe647c7ae9d5b4c81 Mon Sep 17 00:00:00 2001 From: Thang Pham Date: Sun, 5 Jan 2025 15:11:08 -0500 Subject: [PATCH] cleanup --- spotify_player/src/ui/page.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spotify_player/src/ui/page.rs b/spotify_player/src/ui/page.rs index 25b598f6..0f24dd37 100644 --- a/spotify_player/src/ui/page.rs +++ b/spotify_player/src/ui/page.rs @@ -832,17 +832,16 @@ fn render_artist_context_page_windows( // 3. Construct the page's widgets // album table if configs.app_config.sort_artist_albums_by_type { - albums.sort_by(|a, b| { - let get_priority = |album_type: &str| match album_type { + fn get_priority(album_type: &str) -> usize { + match album_type { "album" => 0, "single" => 1, "appears_on" => 2, "compilation" => 3, _ => 4, - }; - - get_priority(&a.album_type()).cmp(&get_priority(&b.album_type())) - }); + } + } + albums.sort_by_key(|a| get_priority(&a.album_type())); } let is_albums_active = is_active && focus_state == ArtistFocusState::Albums;