Skip to content

Commit 65acce6

Browse files
Merge pull request #152 from decathorpe/master
port to rust-ini 0.16
2 parents 817b378 + f9b70e8 commit 65acce6

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ toml = { version = "0.5", optional = true }
2929
serde_json = { version = "1.0.2", optional = true }
3030
yaml-rust = { version = "0.4", optional = true }
3131
serde-hjson = { version = "0.9", default-features = false, optional = true }
32-
rust-ini = { version = "0.13", optional = true }
32+
rust-ini = { version = "0.16", optional = true }
3333

3434
[dev-dependencies]
3535
serde_derive = "1.0.8"

src/file/format/ini.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ pub fn parse(
1111
let mut map: HashMap<String, Value> = HashMap::new();
1212
let i = Ini::load_from_str(text)?;
1313
for (sec, prop) in i.iter() {
14-
match *sec {
15-
Some(ref sec) => {
14+
match sec {
15+
Some(sec) => {
1616
let mut sec_map: HashMap<String, Value> = HashMap::new();
1717
for (k, v) in prop.iter() {
18-
sec_map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone())));
18+
sec_map.insert(
19+
k.to_owned(),
20+
Value::new(uri, ValueKind::String(v.to_owned())),
21+
);
1922
}
20-
map.insert(sec.clone(), Value::new(uri, ValueKind::Table(sec_map)));
23+
map.insert(sec.to_owned(), Value::new(uri, ValueKind::Table(sec_map)));
2124
}
2225
None => {
2326
for (k, v) in prop.iter() {
24-
map.insert(k.clone(), Value::new(uri, ValueKind::String(v.clone())));
27+
map.insert(
28+
k.to_owned(),
29+
Value::new(uri, ValueKind::String(v.to_owned())),
30+
);
2531
}
2632
}
2733
}

tests/file_ini.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn test_error_parse() {
6464
assert_eq!(
6565
res.unwrap_err().to_string(),
6666
format!(
67-
r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#,
67+
r#"2:0 expecting "[Some('='), Some(':')]" but found EOF. in {}"#,
6868
path.display()
6969
)
7070
);

0 commit comments

Comments
 (0)