refactor: remove unnecessary clones and borrows

This commit is contained in:
Harsh Shandilya 2022-02-17 13:11:33 +05:30
parent 0385f033b2
commit 952afdcec3
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -59,12 +59,12 @@ fn loop_clipboard<'a>(config: Replacements<'a>) {
if let Some(subst) = config if let Some(subst) = config
.substitutors .substitutors
.iter() .iter()
.find(|subst| subst.matcher.clone().check_match(&contents)) .find(|subst| subst.matcher.check_match(contents))
{ {
if subst.name.is_empty().not() { if subst.name.is_empty().not() {
debug!("{}: matched on {}...", &subst.name, truncate(&contents, 40)); debug!("{}: matched on {}...", &subst.name, truncate(&contents, 40));
} }
let result = subst.action.clone().apply_action(contents.deref()); let result = subst.action.apply_action(contents);
if let Err(e) = clipboard.set_contents(result.to_owned()) { if let Err(e) = clipboard.set_contents(result.to_owned()) {
error!("{e}"); error!("{e}");
} }