From 2d4b183fce8c9de0d9548f7087786bc919cae7b4 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Sat, 26 Mar 2022 10:42:19 +0100 Subject: refactor: replace module_config_derive with serde (#3786) * refactor: replace module_config_derive with serde Changes include: * Removing `starship_module_config_derive` and replacing it with `serde::Deserialize` * Removing `RootModuleConfig::load_config`. While potentially useful, it was only used in tests. And it would require something like `serde::DeserializeSeed` which is not derived by serde. * Merging `RootModuleConfig` into `ModuleConfig` * Implementing a `ValueDeserializer` that holds a reference to a `toml::Value` in `serde_utils.rs` * Deserialization errors (invalid type) are now logged and include the current key and the struct names * Unknown keys are now considered an error. "Did you mean?"-messages are still possible * fix typo Co-authored-by: Matan Kushner Co-authored-by: Matan Kushner --- src/configs/julia.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/configs/julia.rs') diff --git a/src/configs/julia.rs b/src/configs/julia.rs index 785d229dd..bef950ed5 100644 --- a/src/configs/julia.rs +++ b/src/configs/julia.rs @@ -1,9 +1,7 @@ -use crate::config::ModuleConfig; +use serde::{Deserialize, Serialize}; -use serde::Serialize; -use starship_module_config_derive::ModuleConfig; - -#[derive(Clone, ModuleConfig, Serialize)] +#[derive(Clone, Deserialize, Serialize)] +#[serde(default)] pub struct JuliaConfig<'a> { pub format: &'a str, pub version_format: &'a str, -- cgit v1.2.3