summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-14 09:03:46 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-14 09:03:46 +0100
commita3f205dc628b59a32de813b3efefbaec4667d217 (patch)
tree741dd20a03f39ef5c8994c857c323334576df37b
parent9802e2f47e3d643d353224af0c2e6667b2dfa170 (diff)
parent010895c558ece3247b1ea8b0f90098c7bd254657 (diff)
Merge branch 'update-rust-ini'
-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 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<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 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()
)
);