config: remove unnecessary Default impl

This commit is contained in:
Harsh Shandilya 2021-11-28 16:08:23 +05:30
parent 13bcb918bd
commit d2f1b686a2
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 2 additions and 6 deletions

View file

@ -3,7 +3,7 @@ use std::str::FromStr;
use regex::Regex;
use serde_derive::Deserialize;
#[derive(Clone, Debug, Default, Deserialize)]
#[derive(Clone, Debug, Deserialize)]
pub struct Replacements<'config> {
#[serde(rename = "substitutor", borrow, default)]
pub substitutors: Vec<Substitutor<'config>>,

View file

@ -17,11 +17,7 @@ fn main() -> Result<()> {
config_path.push("config");
config_path.set_extension("toml");
let config_str = std::fs::read_to_string(config_path.as_path()).unwrap_or_default();
let config = if config_path.exists() {
toml::from_str(&config_str)?
} else {
Replacements::default()
};
let config: Replacements<'_> = toml::from_str(&config_str)?;
let mut clipboard: ClipboardContext =
ClipboardProvider::new().expect("Failed to get clipboard");
let mut clipboard_contents = get_clipboard_contents(&mut clipboard);