diff options
Diffstat (limited to 'src/file/format/toml.rs')
-rw-r--r-- | src/file/format/toml.rs | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs index 2df1fca..6c835a4 100644 --- a/src/file/format/toml.rs +++ b/src/file/format/toml.rs @@ -4,31 +4,10 @@ use std::collections::{HashMap, BTreeMap}; use std::error::Error; use value::{Value, ValueKind}; -pub fn parse(uri: Option<&String>, - text: &str, - namespace: Option<&String>) - -> Result<HashMap<String, Value>, Box<Error>> { +pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error>> { // Parse a TOML value from the provided text - let mut root: toml::Value = toml::from_str(text)?; - - // Limit to namespace - if let Some(namespace) = namespace { - root = toml::Value::Table(match root { - toml::Value::Table(ref mut table) => { - if let Some(toml::Value::Table(table)) = - table.remove(namespace) { - table - } else { - BTreeMap::new() - } - } - - _ => BTreeMap::new(), - }); - } - // TODO: Have a proper error fire if the root of a file is ever not a Table - let value = from_toml_value(uri, &root); + let value = from_toml_value(uri, &toml::from_str(text)?); match value.kind { ValueKind::Table(map) => Ok(map), |