summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-18 12:30:43 +0100
committerGitHub <noreply@github.com>2021-03-18 12:30:43 +0100
commit65acce68bcb890a7c182c76f615907cdaf83d6f0 (patch)
tree4aa00d86eb034b08a1969d5f636aa77347c02f91
parent817b37807572418f48e3d660e3931d265e32ab28 (diff)
parentf9b70e838e957189c7ae256d59b9ab2970641899 (diff)
Merge pull request #152 from decathorpe/master
port to rust-ini 0.16
-rw-r--r--Cargo.toml2
-rw-r--r--src/file/format/ini.rs16
-rw-r--r--tests/file_ini.rs2
3 files changed, 13 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ae6e770..dddaad8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,7 +29,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<String, Value> = 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<String, Value> = 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 088eb2c..6dc3522 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()
)
);