Skip to content

Commit

Permalink
tell cargo about all our custom lints
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Aug 23, 2024
1 parent d610ee8 commit d53c279
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 0 additions & 3 deletions esp-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,3 @@ ci = ["async", "embedded-hal-02", "embedded-io", "ufmt", "defmt", "bluetooth", "

[lints.clippy]
mixed_attributes_style = "allow"

[lints.rust]
unexpected_cfgs = "allow"
16 changes: 16 additions & 0 deletions esp-metadata/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Metadata for Espressif devices, primarily intended for use in build scripts.

use anyhow::{bail, Result};
use strum::IntoEnumIterator;

const ESP32_TOML: &str = include_str!("../devices/esp32.toml");
const ESP32C2_TOML: &str = include_str!("../devices/esp32c2.toml");
Expand Down Expand Up @@ -231,9 +232,24 @@ impl Config {

/// Define all symbols for a given configuration.
pub fn define_symbols(&self) {
define_all_possible_symbols();
// Define all necessary configuration symbols for the configured device:
for symbol in self.all() {
println!("cargo:rustc-cfg={symbol}");
}
}
}

/// Defines all possible symbols that _could_ be output from this crate
/// regardless of the chosen configuration.
///
/// This is required to avoid triggering the unexpected-cfgs lint.
fn define_all_possible_symbols() {
for chip in Chip::iter() {
let config = Config::for_chip(&chip);
for symbol in config.all() {
// https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-check-cfg
println!("cargo:rustc-check-cfg=cfg({})", symbol);
}
}
}
3 changes: 0 additions & 3 deletions hil-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,3 @@ incremental = false
opt-level = 3
lto = "fat"
overflow-checks = false

[lints.rust]
unexpected_cfgs = "allow"

0 comments on commit d53c279

Please sign in to comment.