diff --git a/src/config.rs b/src/config.rs index 6fb9602..90e0cb8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -14,7 +14,7 @@ pub struct Substitutor<'config> { #[serde(default)] pub name: &'config str, #[serde(borrow, alias = "matcher")] - pub matcher_type: MatcherType<'config>, + pub matcher: MatcherType<'config>, #[serde(borrow)] pub action: Action<'config>, } diff --git a/src/main.rs b/src/main.rs index a2a0c2d..0ca9597 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,7 +58,7 @@ fn loop_clipboard<'a>(config: Replacements<'a>) { let mut clipboard_contents = get_clipboard_contents(&mut clipboard); while let Ok(contents) = clipboard_contents.as_deref() { if let Some(subst) = config.substitutors.iter().find(|subst| { - return match &subst.matcher_type { + return match &subst.matcher { MatcherType::Single(matcher) => matcher.check_match(contents), MatcherType::Multiple(matchers) => { matchers.iter().all(|matcher| matcher.check_match(contents)) diff --git a/src/test.rs b/src/test.rs index ffa3eab..e22fc13 100644 --- a/src/test.rs +++ b/src/test.rs @@ -52,7 +52,7 @@ fn parse_with_multiple_matchers() { assert_eq!(1, config.substitutors.len()); let subst = &config.substitutors[0]; assert_eq!("Example", subst.name); - assert!(matches!(subst.matcher_type, MatcherType::Multiple(_))); + assert!(matches!(subst.matcher, MatcherType::Multiple(_))); assert!(matches!(subst.action, Action::Prefix { .. })); } @@ -68,6 +68,6 @@ fn parse_with_single_matcher() { assert_eq!(1, config.substitutors.len()); let subst = &config.substitutors[0]; assert_eq!("Example", subst.name); - assert!(matches!(subst.matcher_type, MatcherType::Single(_))); + assert!(matches!(subst.matcher, MatcherType::Single(_))); assert!(matches!(subst.action, Action::Prefix { .. })); }