chore: reformat with new rustfmt config

This commit is contained in:
Harsh Shandilya 2022-03-07 01:25:48 +05:30
parent 2ee2cdb107
commit 5d6b27249d
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 158 additions and 152 deletions

View file

@ -22,7 +22,8 @@ fn main() -> Result<()> {
} }
configure_tracing(); configure_tracing();
let config_path = get_config_path()?; 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)?; let config: Replacements<'_> = toml::from_str(&config_str)?;
loop_clipboard(config); loop_clipboard(config);
Ok(()) Ok(())
@ -51,11 +52,13 @@ fn configure_tracing() {
.with_max_level(Level::TRACE) .with_max_level(Level::TRACE)
.finish(); .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> { 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("substitutor");
config_path.push("config"); config_path.push("config");
config_path.set_extension("toml"); 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() clipboard.get_contents()
} }

View file

@ -1,6 +1,7 @@
use crate::config::{Act, Action, Match, Matcher, MatcherType, Replacements};
use assay::assay; use assay::assay;
use crate::config::{Act, Action, Match, Matcher, MatcherType, Replacements};
#[assay] #[assay]
fn regex_matcher() { fn regex_matcher() {
let matcher = Matcher::Regex { let matcher = Matcher::Regex {