mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-14 20:07:01 +05:30
chore: fix clippy 1.61 lints
This commit is contained in:
parent
eb3074d324
commit
c9f3c63b32
2 changed files with 6 additions and 6 deletions
|
@ -72,7 +72,7 @@ impl Match for Matcher<'_> {
|
||||||
Matcher::EndsWith { suffix } => string.ends_with(suffix),
|
Matcher::EndsWith { suffix } => string.ends_with(suffix),
|
||||||
Matcher::Contains { substring } => string.contains(substring),
|
Matcher::Contains { substring } => string.contains(substring),
|
||||||
Matcher::Regex { pattern } => {
|
Matcher::Regex { pattern } => {
|
||||||
return if let Ok(regex) = Regex::from_str(pattern) {
|
if let Ok(regex) = Regex::from_str(pattern) {
|
||||||
regex.is_match(string)
|
regex.is_match(string)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -23,7 +23,7 @@ fn main() -> Result<()> {
|
||||||
if !check_for_version_arg() {
|
if !check_for_version_arg() {
|
||||||
loop_clipboard(config);
|
loop_clipboard(config);
|
||||||
}
|
}
|
||||||
return Ok(());
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_for_version_arg() -> bool {
|
fn check_for_version_arg() -> bool {
|
||||||
|
@ -34,7 +34,7 @@ fn check_for_version_arg() -> bool {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_version() {
|
fn print_version() {
|
||||||
|
@ -49,10 +49,10 @@ fn get_config_path() -> Result<PathBuf> {
|
||||||
config_path.push("substitutor");
|
config_path.push("substitutor");
|
||||||
config_path.push("config");
|
config_path.push("config");
|
||||||
config_path.set_extension("toml");
|
config_path.set_extension("toml");
|
||||||
return Ok(config_path);
|
Ok(config_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn loop_clipboard<'a>(config: Replacements<'a>) {
|
fn loop_clipboard(config: Replacements) {
|
||||||
let mut clipboard: ClipboardContext =
|
let mut clipboard: ClipboardContext =
|
||||||
ClipboardProvider::new().expect("Failed to get clipboard");
|
ClipboardProvider::new().expect("Failed to get clipboard");
|
||||||
let mut clipboard_contents = get_clipboard_contents(&mut clipboard);
|
let mut clipboard_contents = get_clipboard_contents(&mut clipboard);
|
||||||
|
@ -63,7 +63,7 @@ fn loop_clipboard<'a>(config: Replacements<'a>) {
|
||||||
.find(|subst| subst.matcher.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.apply_action(contents);
|
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()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue