Don't use macros when not needed

This commit is contained in:
Wojciech Kozlowski 2024-01-21 14:33:38 +01:00
parent 9cf8e1375c
commit d59bca8194
3 changed files with 316 additions and 333 deletions

View File

@ -1,8 +1,4 @@
use once_cell::sync::Lazy; pub static DATABASE_JSON: &str = "[\
macro_rules! database_json {
() => {
"[\
{\ {\
\"id\":{\"name\":\"album_artist a\"},\ \"id\":{\"name\":\"album_artist a\"},\
\"sort\":null,\ \"sort\":null,\
@ -137,8 +133,4 @@ macro_rules! database_json {
}\ }\
]\ ]\
}\ }\
]" ]";
};
}
pub static DATABASE_JSON: Lazy<&str> = Lazy::new(|| database_json!());

View File

@ -1,7 +1,6 @@
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
macro_rules! library_beets { pub static LIBRARY_BEETS: Lazy<Vec<String>> = Lazy::new(|| -> Vec<String> {
() => {
vec![ vec![
String::from("album_artist a -*^- -*^- 1998 -*^- album_title a.a -*^- 1 -*^- track a.a.1 -*^- artist a.a.1 -*^- FLAC -*^- 992"), String::from("album_artist a -*^- -*^- 1998 -*^- album_title a.a -*^- 1 -*^- track a.a.1 -*^- artist a.a.1 -*^- FLAC -*^- 992"),
String::from("album_artist a -*^- -*^- 1998 -*^- album_title a.a -*^- 2 -*^- track a.a.2 -*^- artist a.a.2.1; artist a.a.2.2 -*^- MP3 -*^- 320"), String::from("album_artist a -*^- -*^- 1998 -*^- album_title a.a -*^- 2 -*^- track a.a.2 -*^- artist a.a.2.1; artist a.a.2.2 -*^- MP3 -*^- 320"),
@ -17,7 +16,4 @@ macro_rules! library_beets {
String::from("album_artist c -*^- -*^- 2018 -*^- album_title c.b -*^- 1 -*^- track c.b.1 -*^- artist c.b.1 -*^- FLAC -*^- 1041"), String::from("album_artist c -*^- -*^- 2018 -*^- album_title c.b -*^- 1 -*^- track c.b.1 -*^- artist c.b.1 -*^- FLAC -*^- 1041"),
String::from("album_artist c -*^- -*^- 2018 -*^- album_title c.b -*^- 2 -*^- track c.b.2 -*^- artist c.b.2.1; artist c.b.2.2 -*^- FLAC -*^- 756") String::from("album_artist c -*^- -*^- 2018 -*^- album_title c.b -*^- 2 -*^- track c.b.2 -*^- artist c.b.2.1; artist c.b.2.2 -*^- FLAC -*^- 756")
] ]
}; });
}
pub static LIBRARY_BEETS: Lazy<Vec<String>> = Lazy::new(|| library_beets!());

View File

@ -1,10 +1,8 @@
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use crate::library::Item; use crate::{library::Item, Format};
use crate::Format;
macro_rules! library_items { pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
() => {
vec![ vec![
Item { Item {
album_artist: String::from("album_artist a"), album_artist: String::from("album_artist a"),
@ -165,7 +163,4 @@ macro_rules! library_items {
track_bitrate: 756, track_bitrate: 756,
}, },
] ]
}; });
}
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| library_items!());