From 943174bafa1f91c9d33d81caeb15a53efdd6fc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20B=C3=B6ttcher?= Date: Fri, 7 Aug 2020 14:41:07 +0200 Subject: [PATCH] move match macro into utils module --- src/index/metadata.rs | 10 +--------- src/utils.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/index/metadata.rs b/src/index/metadata.rs index c1d9389..a4bf4ec 100644 --- a/src/index/metadata.rs +++ b/src/index/metadata.rs @@ -14,15 +14,7 @@ use opus_headers; use crate::utils; use crate::utils::AudioFormat; -macro_rules! match_ignore_case { - (match $v:ident { - $( $lit:literal => $res:expr, )* - _ => $catch_all:expr $(,)? - }) => {{ - $( if $lit.eq_ignore_ascii_case(&$v) { $res } else )* - { $catch_all } - }}; -} +use crate::match_ignore_case; #[derive(Debug, Clone, PartialEq)] pub struct SongTags { diff --git a/src/utils.rs b/src/utils.rs index 7578b93..356a845 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -3,6 +3,17 @@ use app_dirs::{app_root, AppDataType, AppInfo}; use std::fs; use std::path::{Path, PathBuf}; +#[macro_export] +macro_rules! match_ignore_case { + (match $v:ident { + $( $lit:literal => $res:expr, )* + _ => $catch_all:expr $(,)? + }) => {{ + $( if $lit.eq_ignore_ascii_case(&$v) { $res } else )* + { $catch_all } + }}; +} + #[cfg(target_family = "windows")] const APP_INFO: AppInfo = AppInfo { name: "Polaris",