mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-15 05:27:01 +05:30
chore: reformat with new rustfmt config
This commit is contained in:
parent
2ee2cdb107
commit
5d6b27249d
3 changed files with 158 additions and 152 deletions
13
src/main.rs
13
src/main.rs
|
@ -22,7 +22,8 @@ fn main() -> Result<()> {
|
|||
}
|
||||
configure_tracing();
|
||||
let config_path = get_config_path()?;
|
||||
let config_str = std::fs::read_to_string(config_path.as_path()).unwrap_or_default();
|
||||
let config_str =
|
||||
std::fs::read_to_string(config_path.as_path()).unwrap_or_default();
|
||||
let config: Replacements<'_> = toml::from_str(&config_str)?;
|
||||
loop_clipboard(config);
|
||||
Ok(())
|
||||
|
@ -51,11 +52,13 @@ fn configure_tracing() {
|
|||
.with_max_level(Level::TRACE)
|
||||
.finish();
|
||||
|
||||
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
|
||||
tracing::subscriber::set_global_default(subscriber)
|
||||
.expect("setting default subscriber failed");
|
||||
}
|
||||
|
||||
fn get_config_path() -> Result<PathBuf> {
|
||||
let mut config_path = config_dir().ok_or_else(|| anyhow!("Failed to get config dir"))?;
|
||||
let mut config_path =
|
||||
config_dir().ok_or_else(|| anyhow!("Failed to get config dir"))?;
|
||||
config_path.push("substitutor");
|
||||
config_path.push("config");
|
||||
config_path.set_extension("toml");
|
||||
|
@ -89,7 +92,9 @@ fn loop_clipboard(config: Replacements) {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_clipboard_contents(clipboard: &mut ClipboardContext) -> Result<String, Box<dyn Error>> {
|
||||
fn get_clipboard_contents(
|
||||
clipboard: &mut ClipboardContext,
|
||||
) -> Result<String, Box<dyn Error>> {
|
||||
clipboard.get_contents()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::config::{Act, Action, Match, Matcher, MatcherType, Replacements};
|
||||
use assay::assay;
|
||||
|
||||
use crate::config::{Act, Action, Match, Matcher, MatcherType, Replacements};
|
||||
|
||||
#[assay]
|
||||
fn regex_matcher() {
|
||||
let matcher = Matcher::Regex {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue