Small fixes
This commit is contained in:
parent
e723507897
commit
7cf77c74cc
@ -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 =
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user