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/python.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/configs/python.rs') diff --git a/src/configs/python.rs b/src/configs/python.rs index 1be75deae..e36792fce 100644 --- a/src/configs/python.rs +++ b/src/configs/python.rs @@ -1,9 +1,9 @@ -use crate::config::{ModuleConfig, VecOr}; +use crate::config::VecOr; -use serde::Serialize; -use starship_module_config_derive::ModuleConfig; +use serde::{Deserialize, Serialize}; -#[derive(Clone, ModuleConfig, Serialize)] +#[derive(Clone, Deserialize, Serialize)] +#[serde(default)] pub struct PythonConfig<'a> { pub pyenv_version_name: bool, pub pyenv_prefix: &'a str, -- cgit v1.2.3