Update src/config.rs
Co-authored-by: Eric Huss <eric@huss.org>
This commit is contained in:
parent
2f59dbf1ef
commit
282e55122e
|
@ -145,14 +145,9 @@ impl Config {
|
||||||
if key == "book" || key == "build" {
|
if key == "book" || key == "build" {
|
||||||
if let serde_json::Value::Object(ref map) = parsed_value {
|
if let serde_json::Value::Object(ref map) = parsed_value {
|
||||||
// To `set` each `key`, we wrap them as `prefix.key`
|
// To `set` each `key`, we wrap them as `prefix.key`
|
||||||
let prefix = &key; // "book" or "build"
|
|
||||||
let mut s = String::new();
|
|
||||||
for (k, v) in map {
|
for (k, v) in map {
|
||||||
s.clear();
|
let full_key = format!("{}.{}", key, k);
|
||||||
s.push_str(prefix);
|
self.set(&full_key, v).expect("unreachable");
|
||||||
s.push('.');
|
|
||||||
s.push_str(k);
|
|
||||||
self.set(&s, v).expect("unreachable");
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue