diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-05-29 12:46:16 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-05-29 18:39:25 +0200 |
commit | a7d53e47d1fe15ed7163d5612fef2976c9be9098 (patch) | |
tree | 6d5c448f701b740b5d9d303b3802c588151b9d8a /lib/core | |
parent | 1482f7032059c6a1df90380b5cc17998afaae93a (diff) |
Update toml-query to 0.9.0
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/libimagrt/Cargo.toml | 2 | ||||
-rw-r--r-- | lib/core/libimagstore/Cargo.toml | 2 | ||||
-rw-r--r-- | lib/core/libimagstore/src/store.rs | 29 |
3 files changed, 17 insertions, 16 deletions
diff --git a/lib/core/libimagrt/Cargo.toml b/lib/core/libimagrt/Cargo.toml index c1f07a00..63e97ee2 100644 --- a/lib/core/libimagrt/Cargo.toml +++ b/lib/core/libimagrt/Cargo.toml @@ -25,7 +25,7 @@ toml = "0.5" xdg-basedir = "1.0" itertools = "0.7" ansi_term = "0.11" -toml-query = "0.8" +toml-query = "0.9" atty = "0.2" failure = "0.1" failure_derive = "0.1" diff --git a/lib/core/libimagstore/Cargo.toml b/lib/core/libimagstore/Cargo.toml index 8b18bf9f..0738d0ce 100644 --- a/lib/core/libimagstore/Cargo.toml +++ b/lib/core/libimagstore/Cargo.toml @@ -29,7 +29,7 @@ walkdir = "2" is-match = "0.1" serde = "1" serde_json = "1" -toml-query = "0.8" +toml-query = "0.9" failure = "0.1" libimagerror = { version = "0.10.0", path = "../../../lib/core/libimagerror" } diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index 8c45fa45..13fbf245 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -18,7 +18,6 @@ // use std::collections::HashMap; -use std::collections::BTreeMap; use std::ops::Drop; use std::path::PathBuf; use std::result::Result as RResult; @@ -774,11 +773,13 @@ impl Entry { /// /// This function should be used to get a new Header, as the default header may change. Via /// this function, compatibility is ensured. - pub fn default_header() -> Value { // BTreeMap<String, Value> - let mut m = BTreeMap::new(); + pub fn default_header() -> Value { // Map<String, Value> + use toml::map::Map; + + let mut m = Map::new(); m.insert(String::from("imag"), { - let mut imag_map = BTreeMap::<String, Value>::new(); + let mut imag_map = Map::new(); imag_map.insert(String::from("version"), Value::String(String::from(env!("CARGO_PKG_VERSION")))); @@ -930,12 +931,12 @@ fn has_imag_version_in_main_section(t: &Value) -> Result<bool> { mod test { extern crate env_logger; - use std::collections::BTreeMap; use crate::storeid::StoreId; use crate::store::has_main_section; use crate::store::has_imag_version_in_main_section; use toml::Value; + use toml::map::Map; fn setup_logging() { let _ = env_logger::try_init(); @@ -943,15 +944,15 @@ mod test { #[test] fn test_imag_section() { - let mut map = BTreeMap::new(); - map.insert("imag".into(), Value::Table(BTreeMap::new())); + let mut map = Map::new(); + map.insert("imag".into(), Value::Table(Map::new())); assert!(has_main_section(&Value::Table(map)).unwrap()); } #[test] fn test_imag_abscent_main_section() { - let mut map = BTreeMap::new(); + let mut map = Map::new(); map.insert("not_imag".into(), Value::Boolean(false)); assert!(has_main_section(&Value::Table(map)).is_err()); @@ -959,16 +960,16 @@ mod test { #[test] fn test_main_section_without_version() { - let mut map = BTreeMap::new(); - map.insert("imag".into(), Value::Table(BTreeMap::new())); + let mut map = Map::new(); + map.insert("imag".into(), Value::Table(Map::new())); assert!(has_imag_version_in_main_section(&Value::Table(map)).is_err()); } #[test] fn test_main_section_with_version() { - let mut map = BTreeMap::new(); - let mut sub = BTreeMap::new(); + let mut map = Map::new(); + let mut sub = Map::new(); sub.insert("version".into(), Value::String("0.0.0".into())); map.insert("imag".into(), Value::Table(sub)); @@ -977,8 +978,8 @@ mod test { #[test] fn test_main_section_with_version_in_wrong_type() { - let mut map = BTreeMap::new(); - let mut sub = BTreeMap::new(); + let mut map = Map::new(); + let mut sub = Map::new(); sub.insert("version".into(), Value::Boolean(false)); map.insert("imag".into(), Value::Table(sub)); |