chore: Cleanup after the config refactor (#453)
This commit is contained in:
parent
52bd37b372
commit
c39506c6f6
|
@ -17,3 +17,7 @@ Cargo.lock
|
|||
|
||||
# Vim swap files
|
||||
*.swp
|
||||
|
||||
# Compiled files for documentation
|
||||
docs/node_modules
|
||||
docs/.vuepress/dist/
|
||||
|
|
|
@ -780,7 +780,6 @@ version = "0.20.0"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"starship 0.20.0",
|
||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(dead_code)]
|
||||
use crate::configs::StarshipRootConfig;
|
||||
use crate::utils;
|
||||
use ansi_term::{Color, Style};
|
||||
|
|
|
@ -11,34 +11,6 @@ pub struct RustConfig<'a> {
|
|||
pub disabled: bool,
|
||||
}
|
||||
|
||||
/* This is what the macro adds.
|
||||
impl<'a> ModuleConfig<'a> for RustConfig<'a> {
|
||||
fn load_config(&self, config: &'a toml::Value) -> Self {
|
||||
let mut new_module_config = self.clone();
|
||||
if let toml::Value::Table(config) = config {
|
||||
if let Some(config_str) = config.get("symbol") {
|
||||
new_module_config.symbol = new_module_config.symbol.load_config(config_str);
|
||||
}
|
||||
if let Some(config_str) = config.get("disabled") {
|
||||
new_module_config.disabled = new_module_config.disabled.load_config(config_str);
|
||||
}
|
||||
if let Some(config_str) = config.get("style") {
|
||||
new_module_config.style = new_module_config.style.load_config(config_str);
|
||||
}
|
||||
}
|
||||
new_module_config
|
||||
}
|
||||
fn from_config(config: &'a toml::Value) -> Option<Self> {
|
||||
let config = config.as_table()?;
|
||||
Some(RustConfig {
|
||||
symbol: <&'a str>::from_config(config.get("symbol")?)?,
|
||||
style: <Style>::from_config(config.get("style")?)?,
|
||||
disabled: <bool>::from_config(config.get("disabled")?)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
impl<'a> RootModuleConfig<'a> for RustConfig<'a> {
|
||||
fn new() -> Self {
|
||||
RustConfig {
|
||||
|
|
|
@ -204,15 +204,6 @@ impl<'a> Module<'a> {
|
|||
pub fn config_value_style(&self, key: &str) -> Option<Style> {
|
||||
<Style>::from_config(self.config?.as_table()?.get(key)?)
|
||||
}
|
||||
|
||||
/// Get a module's config value as a table of segment config
|
||||
#[deprecated(
|
||||
since = "0.20.0",
|
||||
note = "please use <RootModuleConfig>::try_load(module.config) instead"
|
||||
)]
|
||||
pub fn config_value_segment_config(&self, key: &str) -> Option<SegmentConfig> {
|
||||
<SegmentConfig>::from_config(self.config?.as_table()?.get(key)?)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for Module<'a> {
|
||||
|
|
|
@ -23,6 +23,3 @@ proc-macro = true
|
|||
proc-macro2 = "~1"
|
||||
quote = "~1"
|
||||
syn = "~1"
|
||||
|
||||
[dev-dependencies]
|
||||
starship = { version = "0.20.0", path = "../starship" }
|
||||
|
|
Loading…
Reference in New Issue