diff options
author | David Knaack <davidkna@users.noreply.github.com> | 2022-03-26 10:42:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 10:42:19 +0100 |
commit | 2d4b183fce8c9de0d9548f7087786bc919cae7b4 (patch) | |
tree | 924114efeef59bfe80a0b9f5fec4fdb7acf2800b /src/configs/rust.rs | |
parent | 0fb421969058ec07a09f7c927dddc1258de75631 (diff) |
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 <hello@matchai.dev>
Co-authored-by: Matan Kushner <hello@matchai.dev>
Diffstat (limited to 'src/configs/rust.rs')
-rw-r--r-- | src/configs/rust.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/configs/rust.rs b/src/configs/rust.rs index a007fc5de..52b6d2093 100644 --- a/src/configs/rust.rs +++ b/src/configs/rust.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 RustConfig<'a> { pub format: &'a str, pub version_format: &'a str, |