Skip to content

Commit

Permalink
style: fix all unexpected cfgs (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel authored Jan 14, 2025
1 parent c7d2152 commit 8b3b608
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 38 deletions.
57 changes: 33 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions dfir_rs/tests/surface_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ fn test_all() {
let examples_files = read_dir("examples/")
.unwrap()
.flat_map(Result::ok)
.filter(|entry| {
entry
.file_type()
.map_or(false, |file_type| file_type.is_file())
})
.filter(|entry| entry.file_type().is_ok_and(|file_type| file_type.is_file()))
.map(|entry| entry.file_name())
.map(|filename| filename.into_string().unwrap())
.filter(|filename| filename.starts_with("example_") && filename.ends_with(".rs"))
Expand Down
5 changes: 5 additions & 0 deletions hydro_deploy/core/src/deployment.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#![allow(
unexpected_cfgs,
reason = "https://github.com/BrynCooke/buildstructor/issues/192"
)]

use std::collections::HashMap;
use std::future::Future;
use std::sync::{Arc, Weak};
Expand Down
4 changes: 4 additions & 0 deletions hydro_deploy/core/src/hydroflow_crate/tracing_options.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![allow(clippy::too_many_arguments, reason = "buildstructor")]
#![allow(
unexpected_cfgs,
reason = "https://github.com/BrynCooke/buildstructor/issues/192"
)]

use std::path::PathBuf;

Expand Down
4 changes: 1 addition & 3 deletions multiplatform_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ impl Platform {
Platform::Tokio => quote! { #[tokio::test ] },
Platform::AsyncStd => quote! { #[async_std::test] },
Platform::Dfir => quote! { #[dfir_rs::test] },
Platform::Wasm => {
quote! { #[wasm_bindgen_test::wasm_bindgen_test] }
}
Platform::Wasm => quote! { #[wasm_bindgen_test::wasm_bindgen_test] },
Platform::EnvLogging | Platform::EnvTracing => Default::default(),
}
}
Expand Down
6 changes: 4 additions & 2 deletions stageleft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ macro_rules! stageleft_crate {
"lib_macro.rs"
));

#[cfg(not(feature = "stageleft_devel"))]
#[cfg(not(stageleft_macro))]
#[doc(hidden)]
#[allow(
unused,
ambiguous_glob_reexports,
unexpected_cfgs,
clippy::suspicious_else_formatting,
reason = "generated code"
)]
pub mod __staged {
#[cfg(not(feature = "stageleft_devel"))]
include!(concat!(
env!("OUT_DIR"),
$crate::PATH_SEPARATOR!(),
Expand All @@ -76,16 +77,17 @@ macro_rules! stageleft_crate {
#[macro_export]
macro_rules! stageleft_no_entry_crate {
() => {
#[cfg(not(feature = "stageleft_devel"))]
#[doc(hidden)]
#[allow(
unused,
ambiguous_glob_reexports,
unexpected_cfgs,
clippy::suspicious_else_formatting,
clippy::type_complexity,
reason = "generated code"
)]
pub mod __staged {
#[cfg(not(feature = "stageleft_devel"))]
include!(concat!(
env!("OUT_DIR"),
$crate::PATH_SEPARATOR!(),
Expand Down
14 changes: 10 additions & 4 deletions stageleft_tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,22 @@ pub fn gen_final_helper() {
)
.unwrap();

println!("cargo::rustc-check-cfg=cfg(stageleft_macro)");
println!("cargo::rerun-if-changed=build.rs");
println!("cargo::rerun-if-changed=src");
}

#[macro_export]
macro_rules! gen_final {
() => {
#[allow(unexpected_cfgs)]
#[cfg(not(feature = "stageleft_devel"))]
$crate::gen_final_helper()
#[allow(
unexpected_cfgs,
reason = "Consumer crates may optionally add the `stageleft_devel` feature."
)]
{
println!("cargo::rustc-check-cfg=cfg(stageleft_macro)");

#[cfg(not(feature = "stageleft_devel"))]
$crate::gen_final_helper()
}
};
}

0 comments on commit 8b3b608

Please sign in to comment.