Skip to content

Commit d02cf0e

Browse files
author
Andronik Ordian
committed
Update toml dependency to 0.4
1 parent 5f9307f commit d02cf0e

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ env_logger = "0.4"
3939
hex = "0.2"
4040
license-exprs = "^1.3"
4141
dotenv = "0.10.0"
42-
toml = "0.2"
42+
toml = "0.4"
4343
diesel = { version = "0.13.0", features = ["postgres", "serde_json", "deprecated-time", "chrono"] }
4444
diesel_codegen = "0.13.0"
4545
r2d2-diesel = "0.13.0"

src/categories.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Category {
3939
}
4040
}
4141

42-
fn required_string_from_toml<'a>(toml: &'a toml::Table, key: &str) -> CargoResult<&'a str> {
42+
fn required_string_from_toml<'a>(toml: &'a toml::value::Table, key: &str) -> CargoResult<&'a str> {
4343
toml.get(key).and_then(toml::Value::as_str).chain_error(|| {
4444
internal(&format_args!(
4545
"Expected category TOML attribute '{}' to be a String",
@@ -48,12 +48,12 @@ fn required_string_from_toml<'a>(toml: &'a toml::Table, key: &str) -> CargoResul
4848
})
4949
}
5050

51-
fn optional_string_from_toml<'a>(toml: &'a toml::Table, key: &str) -> &'a str {
51+
fn optional_string_from_toml<'a>(toml: &'a toml::value::Table, key: &str) -> &'a str {
5252
toml.get(key).and_then(toml::Value::as_str).unwrap_or("")
5353
}
5454

5555
fn categories_from_toml(
56-
categories: &toml::Table,
56+
categories: &toml::value::Table,
5757
parent: Option<&Category>,
5858
) -> CargoResult<Vec<Category>> {
5959
let mut result = vec![];
@@ -92,9 +92,8 @@ pub fn sync() -> CargoResult<()> {
9292
let tx = conn.transaction().unwrap();
9393

9494
let categories = include_str!("./categories.toml");
95-
let toml = toml::Parser::new(categories).parse().expect(
96-
"Could not parse categories.toml",
97-
);
95+
let toml: toml::value::Table =
96+
toml::from_str(categories).expect("Could not parse categories.toml");
9897

9998
let categories =
10099
categories_from_toml(&toml, None).expect("Could not convert categories from TOML");

0 commit comments

Comments
 (0)