From 010895c558ece3247b1ea8b0f90098c7bd254657 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Wed, 9 Dec 2020 23:45:51 +0100 Subject: Update dependency: rust-ini: 0.13 -> 0.16 Cherry picked, fixed merge conflict in Cargo.toml and ran cargo-fmt on the new tree. (cherry picked from commit 43ca83a4fa6ea55274f7c78a1914fe93476916ed) Signed-off-by: Matthias Beyer --- Cargo.toml | 2 +- src/file/format/ini.rs | 16 +++++++++++----- tests/file_ini.rs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a5d0c3..2d16216 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ toml = { version = "0.5", optional = true } serde_json = { version = "1.0.2", optional = true } yaml-rust = { version = "0.4", optional = true } serde-hjson = { version = "0.9", default-features = false, optional = true } -rust-ini = { version = "0.13", optional = true } +rust-ini = { version = "0.16", optional = true } [dev-dependencies] serde_derive = "1.0.8" diff --git a/src/file/format/ini.rs b/src/file/format/ini.rs index e5a109f..bc51def 100644 --- a/src/file/format/ini.rs +++ b/src/file/format/ini.rs @@ -11,17 +11,23 @@ pub fn parse( let mut map: HashMap = HashMap::new(); let i = Ini::load_from_str(text)?; for (sec, prop) in i.iter() { - match *sec { - Some(ref sec) => { + match sec { + Some(sec) => { let mut sec_map: HashMap = HashMap::new(); for (k, v) in prop.iter() { - sec_map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone()))); + sec_map.insert( + k.to_owned(), + Value::new(uri, ValueKind::String(v.to_owned())), + ); } - map.insert(sec.clone(), Value::new(uri, ValueKind::Table(sec_map))); + map.insert(sec.to_owned(), Value::new(uri, ValueKind::Table(sec_map))); } None => { for (k, v) in prop.iter() { - map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone()))); + map.insert( + k.to_owned(), + Value::new(uri, ValueKind::String(v.to_owned())), + ); } } } diff --git a/tests/file_ini.rs b/tests/file_ini.rs index a54f0fe..e473158 100644 --- a/tests/file_ini.rs +++ b/tests/file_ini.rs @@ -64,7 +64,7 @@ fn test_error_parse() { assert_eq!( res.unwrap_err().to_string(), format!( - r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#, + r#"2:0 expecting "[Some('='), Some(':')]" but found EOF. in {}"#, path.display() ) ); -- cgit v1.2.3