Skip to content

Commit 0c16838

Browse files
committed
refacto: Use register_config_value in mithril-doc crate
1 parent 6d4267b commit 0c16838

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/mithril-doc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ config = "0.15.7"
1515
mithril-doc-derive = { path = "../mithril-doc-derive" }
1616

1717
[dev-dependencies]
18+
mithril-cli-helper = { path = "../mithril-cli-helper" }
1819
regex = "1.11.1"
1920

2021
[features]

internal/mithril-doc/src/test_doc_macro.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#[cfg(test)]
22
mod tests {
33
use crate::{Documenter, DocumenterDefault, StructDoc};
4-
use config::{Map, Source, Value, ValueKind};
4+
use config::{Map, Source, Value};
5+
use mithril_cli_helper::register_config_value;
56

67
#[allow(dead_code)]
78
#[derive(Debug, Clone, mithril_doc_derive::Documenter)]
@@ -32,11 +33,10 @@ mod tests {
3233
fn collect(&self) -> Result<Map<String, Value>, config::ConfigError> {
3334
let mut result = Map::new();
3435
let namespace = "default configuration".to_string();
36+
3537
let myself = self.clone();
36-
result.insert(
37-
"environment".to_string(),
38-
Value::new(Some(&namespace), ValueKind::from(myself.environment)),
39-
);
38+
register_config_value!(result, &namespace, myself.environment);
39+
4040
Ok(result)
4141
}
4242
}

0 commit comments

Comments
 (0)