Skip to content

allow unused_features lint#114

Merged
BennoLossin merged 1 commit intomainfrom
dev/allow-unused-features
Mar 7, 2026
Merged

allow unused_features lint#114
BennoLossin merged 1 commit intomainfrom
dev/allow-unused-features

Conversation

@BennoLossin
Copy link
Member

The unused_features lint was introduced in rust-lang/rust#152164, presumably landing in Rust 1.96.0. We simplified the way we use features in #102, always enabling them when building the crate with certain features enabled. For this reason allow the lint.

I plan to also add a new CI run that enables the lint & checks if we can remove certain features. Will do so at a later point in time.

This PR fixes the CI failure observed in https://github.com/Rust-for-Linux/pin-init/actions/runs/22754182535

The `unused_features` lint was introduced in [1], presumably landing in
Rust 1.96.0. We simplified the way we use features in #102, always
enabling them when building the crate with certain features enabled. For
this reason allow the lint.

Link: rust-lang/rust#152164 [1]
Signed-off-by: Benno Lossin <lossin@kernel.org>
Copy link
Member

@nbdd0121 nbdd0121 left a comment

Choose a reason for hiding this comment

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

We would also need to enable this in general for other kernel crates, I think?

@BennoLossin
Copy link
Member Author

Yes, I already notified Miguel (although in the kernel it only is a warning as opposed to here where it is an error due to our deny(warnings)).

@nbdd0121
Copy link
Member

nbdd0121 commented Mar 6, 2026

There's CONFIG_WERROR so it's also problematic

@ojeda
Copy link
Member

ojeda commented Mar 6, 2026

Yeah, e.g. from one of my builds:

error: feature `lint_reasons` is declared but not used
   --> rust/pin-init/src/lib.rs:267:56
    |
267 | #![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
    |                                                        ^^^^^^^^^^^^
    |
    = note: `-D unused-features` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_features)]`

I will put a workaround for rust.docs.kernel.org for now.

@BennoLossin BennoLossin marked this pull request as ready for review March 7, 2026 06:39
@BennoLossin BennoLossin merged commit bad9e6a into main Mar 7, 2026
26 checks passed
@BennoLossin
Copy link
Member Author

I tried to set up a CI check, but it didn't work, since the unused_features lint apparently also lints when a feature is stable and used, see rust-lang/rust#153523

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants