aboutsummaryrefslogtreecommitdiff
path: root/alacritty_config_derive/src/serde_replace.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2023-06-12 02:23:41 +0200
committerGitHub <noreply@github.com>2023-06-12 00:23:41 +0000
commitbd4906722a1a026b01f06c94c33b13ff63a7e044 (patch)
treea2713a7b0a5fa23ec8b9055d7ed06f1cede62447 /alacritty_config_derive/src/serde_replace.rs
parentea2c39e65d21728e0f04b0eafcec7153e4447cd5 (diff)
downloadalacritty-bd4906722a1a026b01f06c94c33b13ff63a7e044.tar.gz
alacritty-bd4906722a1a026b01f06c94c33b13ff63a7e044.zip
Switch to TOML configuration format
This switches Alacritty's default configuration format from yaml to toml. While yaml is still supported, it is done by converting it to toml and should be removed entirely in the future. All existing features were persisted based on my testing. Behavior should not change much, though `--option` might have slightly different behavior since the entire line is not interpreted as one line of toml. A new `alacritty migrate` subcommand has been added which allows automatic migration from yaml to toml. This also could be used as a facility to automatically fix configuration file changes in the future. Closes #6592.
Diffstat (limited to 'alacritty_config_derive/src/serde_replace.rs')
-rw-r--r--alacritty_config_derive/src/serde_replace.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs
index 4a0a6a99..7ca5ca7c 100644
--- a/alacritty_config_derive/src/serde_replace.rs
+++ b/alacritty_config_derive/src/serde_replace.rs
@@ -28,7 +28,7 @@ pub fn derive(input: TokenStream) -> TokenStream {
pub fn derive_direct(ident: Ident, generics: Generics) -> TokenStream2 {
quote! {
impl <#generics> alacritty_config::SerdeReplace for #ident <#generics> {
- fn replace(&mut self, key: &str, value: serde_yaml::Value) -> Result<(), Box<dyn std::error::Error>> {
+ fn replace(&mut self, key: &str, value: toml::Value) -> Result<(), Box<dyn std::error::Error>> {
if !key.is_empty() {
let error = format!("Fields \"{}\" do not exist", key);
return Err(error.into());
@@ -53,7 +53,7 @@ pub fn derive_recursive<T>(
quote! {
#[allow(clippy::extra_unused_lifetimes)]
impl <'de, #constrained> alacritty_config::SerdeReplace for #ident <#unconstrained> {
- fn replace(&mut self, key: &str, value: serde_yaml::Value) -> Result<(), Box<dyn std::error::Error>> {
+ fn replace(&mut self, key: &str, value: toml::Value) -> Result<(), Box<dyn std::error::Error>> {
if key.is_empty() {
*self = serde::Deserialize::deserialize(value)?;
return Ok(());