Skip to content

Commit

Permalink
fix and check compilation with no features
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Oct 23, 2024
1 parent 8b809ac commit 6728118
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
with:
key: ${{ matrix.TARGET }}

- run: cargo check --target ${{ matrix.TARGET }} --no-default-features
env:
RUSTFLAGS: -D warnings
- run: cargo check --target ${{ matrix.TARGET }}
env:
RUSTFLAGS: -D warnings
Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Config {
pub base_address_shift: u64,
pub html_url: Option<url::Url>,
/// Path to YAML file with chip-specific settings
#[cfg(feature = "yaml")]
pub settings: Option<PathBuf>,
}

Expand Down
3 changes: 3 additions & 0 deletions src/generate/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
}
};

#[cfg(feature = "yaml")]
let settings = match config.settings.as_ref() {
Some(settings) => {
let file = std::fs::read_to_string(settings).context("could not read settings file")?;
Some(serde_yaml::from_str(&file).context("could not parse settings file")?)
}
None => None,
};
#[cfg(not(feature = "yaml"))]
let settings = None;

if config.target == Target::Msp430 {
out.extend(quote! {
Expand Down

0 comments on commit 6728118

Please sign in to comment.