chore: revert to default formatting style

This commit is contained in:
Harsh Shandilya 2025-01-19 17:55:01 +05:30
parent 142676ac1d
commit 6048f7a537
6 changed files with 169 additions and 185 deletions

View file

@ -5,24 +5,23 @@ use std::time::Duration;
use tracing::{debug, error};
pub fn monitor(config: &Replacements) -> Result<()> {
loop {
let mut clipboard =
ClipboardContext::new().expect("Failed to get clipboard");
if let Ok(contents) = clipboard.get_contents() {
if let Some(subst) = config
.substitutors
.iter()
.find(|subst| subst.matcher.check_match(&contents))
{
if !subst.name.is_empty() {
debug!(?subst.name, ?contents);
loop {
let mut clipboard = ClipboardContext::new().expect("Failed to get clipboard");
if let Ok(contents) = clipboard.get_contents() {
if let Some(subst) = config
.substitutors
.iter()
.find(|subst| subst.matcher.check_match(&contents))
{
if !subst.name.is_empty() {
debug!(?subst.name, ?contents);
}
let result = subst.action.apply_action(&contents);
if let Err(e) = clipboard.set_contents(result) {
error!("{}", e);
}
};
}
let result = subst.action.apply_action(&contents);
if let Err(e) = clipboard.set_contents(result) {
error!("{}", e);
}
};
std::thread::sleep(Duration::from_millis(1_000));
}
std::thread::sleep(Duration::from_millis(1_000));
}
}