Minor review fixes
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m47s
Cargo CI / Lint (pull_request) Successful in 1m17s

This commit is contained in:
Wojciech Kozlowski 2024-03-07 23:09:19 +01:00
parent 61ad045365
commit a9a90f4162
2 changed files with 9 additions and 7 deletions

View File

@ -5,11 +5,9 @@ use std::{
use crate::core::collection::{ use crate::core::collection::{
merge::{Merge, MergeSorted, WithId}, merge::{Merge, MergeSorted, WithId},
track::Track, track::{Track, TrackFormat},
}; };
use super::track::TrackFormat;
/// An album is a collection of tracks that were released together. /// An album is a collection of tracks that were released together.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Album { pub struct Album {

View File

@ -302,7 +302,6 @@ impl<'a, 'b> AlbumState<'a, 'b> {
.map(|a| Self::display_album_date(&a.date)) .map(|a| Self::display_album_date(&a.date))
.unwrap_or_default(), .unwrap_or_default(),
album album
.filter(|a| a.seq.0 > 0)
.map(|a| Self::display_album_seq(&a.seq)) .map(|a| Self::display_album_seq(&a.seq))
.unwrap_or_default(), .unwrap_or_default(),
album album
@ -340,7 +339,11 @@ impl<'a, 'b> AlbumState<'a, 'b> {
} }
fn display_album_seq(seq: &AlbumSeq) -> String { 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 { fn display_album_status(status: &AlbumStatus) -> &'static str {
@ -495,7 +498,7 @@ impl Ui {
} }
fn highlight_style(active: bool) -> Style { 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 { if active {
Style::default().bg(COLOR_BG_HL) Style::default().bg(COLOR_BG_HL)
} else { } else {
@ -818,7 +821,8 @@ mod tests {
#[test] #[test]
fn display_album_seq() { 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)"); assert_eq!(AlbumState::display_album_seq(&AlbumSeq(5)), " (5)");
} }