Skip to content

Commit

Permalink
port to rust-ini 0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Dec 9, 2020
1 parent bf09a73 commit 43ca83a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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", optional = true }
rust-ini = { version = "0.13", optional = true }
rust-ini = { version = "0.16", optional = true }

[dev-dependencies]
serde_derive = "1.0.8"
Expand Down
10 changes: 5 additions & 5 deletions src/file/format/ini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ 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())));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/file_ini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
);
Expand Down

0 comments on commit 43ca83a

Please sign in to comment.