Skip to content

Remove cfgs based on nonexisting features#127

Open
pmikolajczyk41 wants to merge 4 commits intobytecodealliance:mainfrom
OffchainLabs:remove-old-cfg
Open

Remove cfgs based on nonexisting features#127
pmikolajczyk41 wants to merge 4 commits intobytecodealliance:mainfrom
OffchainLabs:remove-old-cfg

Conversation

@pmikolajczyk41
Copy link

Removing almost 20 cfgs that were using nonexisting features (rust_1_40 and cargo-clippy). They were polluting build output with warnings.

///
/// See also https://en.cppreference.com/w/c/language/arithmetic_types
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "rust_1_40", non_exhaustive)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust_1_40 is set in the build script when the rustc version is at least 1.40.

Comment on lines 5 to 17
#![cfg_attr(
feature = "cargo-clippy",
warn(
clippy::float_arithmetic,
clippy::mut_mut,
clippy::nonminimal_bool,
clippy::option_map_unwrap_or,
clippy::option_map_unwrap_or_else,
clippy::print_stdout,
clippy::unicode_not_nfc,
clippy::use_self,
)
)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo-clippy is set when running cargo clippy.

@pmikolajczyk41
Copy link
Author

pmikolajczyk41 commented Feb 13, 2026

my apologies @bjorn3; in that case, would you allow me to add #![allow(unexpected_cfgs)] instead?

@bjorn3
Copy link
Contributor

bjorn3 commented Feb 13, 2026

Please add appropriate cargo::rustc-check-cfg directives to build.rs instead: https://doc.rust-lang.org/stable/cargo/reference/build-scripts.html#rustc-check-cfg

@pmikolajczyk41
Copy link
Author

@bjorn3 for some reason I couldn't make it work with printing cargo::rustc-check-cfg=cfg(feature, values(\"rust_1_40\")) from build.rs (neither with single nor double colon after cargo). It also didn't work when I tried doing it without a feature, just with a raw config rust_1_40. What helped, was adding a lint rule to the Cargo.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants