diff --git a/src/core/collection/album.rs b/src/core/collection/album.rs index 8186f04..ccbd707 100644 --- a/src/core/collection/album.rs +++ b/src/core/collection/album.rs @@ -5,11 +5,9 @@ use std::{ use crate::core::collection::{ merge::{Merge, MergeSorted, WithId}, - track::Track, + track::{Track, TrackFormat}, }; -use super::track::TrackFormat; - /// An album is a collection of tracks that were released together. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Album { diff --git a/src/tui/ui.rs b/src/tui/ui.rs index b147c27..3959a03 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -302,7 +302,6 @@ impl<'a, 'b> AlbumState<'a, 'b> { .map(|a| Self::display_album_date(&a.date)) .unwrap_or_default(), album - .filter(|a| a.seq.0 > 0) .map(|a| Self::display_album_seq(&a.seq)) .unwrap_or_default(), album @@ -340,7 +339,11 @@ impl<'a, 'b> AlbumState<'a, 'b> { } fn display_album_seq(seq: &AlbumSeq) -> String { - format!(" ({})", seq.0) + if seq.0 > 0 { + format!(" ({})", seq.0) + } else { + String::new() + } } fn display_album_status(status: &AlbumStatus) -> &'static str { @@ -495,7 +498,7 @@ impl Ui { } fn highlight_style(active: bool) -> Style { - // Do not set foreground colour to not overwrite any list-specific customisation. + // Do not set the fg color here as it will overwrite any list-specific customisation. if active { Style::default().bg(COLOR_BG_HL) } else { @@ -818,7 +821,8 @@ mod tests { #[test] fn display_album_seq() { - assert_eq!(AlbumState::display_album_seq(&AlbumSeq::default()), " (0)"); + assert_eq!(AlbumState::display_album_seq(&AlbumSeq::default()), ""); + assert_eq!(AlbumState::display_album_seq(&AlbumSeq(0)), ""); assert_eq!(AlbumState::display_album_seq(&AlbumSeq(5)), " (5)"); }