Small fixes
Some checks failed
Cargo CI / Build and Test (pull_request) Failing after 2m6s
Cargo CI / Lint (pull_request) Successful in 1m6s

This commit is contained in:
Wojciech Kozlowski 2025-01-03 16:55:39 +01:00
parent e723507897
commit 7cf77c74cc
3 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,8 @@ use crate::core::collection::{
track::{Track, TrackFormat},
};
use super::string;
/// An album is a collection of tracks that were released together.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Album {
@ -314,7 +316,8 @@ impl AlbumId {
}
pub fn compatible(&self, other: &AlbumId) -> bool {
let titles_compatible = self.title == other.title;
let titles_compatible =
string::normalize_string(&self.title) == string::normalize_string(&other.title);
let lib_id_compatible =
self.lib_id.is_none() || other.lib_id.is_none() || (self.lib_id == other.lib_id);
let mb_ref_compatible =

View File

@ -285,7 +285,8 @@ impl ArtistId {
}
pub fn compatible(&self, other: &ArtistId) -> bool {
let names_compatible = self.name == other.name;
let names_compatible =
string::normalize_string(&self.name) == string::normalize_string(&other.name);
let mb_ref_compatible =
self.mb_ref.is_none() || other.mb_ref.is_none() || (self.mb_ref == other.mb_ref);
names_compatible && mb_ref_compatible

View File

@ -54,6 +54,7 @@ pub fn normalize_string(string: &str) -> NormalString {
#[cfg(test)]
mod benches {
// The purpose of these benches was to evaluate the benefit of AhoCorasick over std solutions.
// The winners are left to allow comparison with future alternatives.
use test::Bencher;
use crate::core::collection::benchmod::ARTISTS;