Skip to content

Commit

Permalink
ensure that the defaults of the arch section are populated
Browse files Browse the repository at this point in the history
Calling defaults without actually having a section is resulting in none
of the fields being populated properly. Likely a serde bug.
  • Loading branch information
cardoe committed Dec 7, 2019
1 parent 25eaca5 commit 3c06037
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/config/meta.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
//! Metadata for different platform's package
use super::arch::CargoArch;

use std::default::Default;

/// data in `[package.metadata]` section
#[derive(Clone, Debug, Default, Deserialize)]
#[derive(Clone, Debug, Deserialize)]
pub struct CargoMetadata {
#[serde(default)]
pub arch: CargoArch,
}

impl Default for CargoMetadata {
// if we do not decode an empty [arch] block then the defaults are
// not actually populated
fn default() -> Self {
toml::from_str("[arch]").unwrap()
}
}

0 comments on commit 3c06037

Please sign in to comment.