Redundant imports from std
prelude in maybe-no_std crate
#12335
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
This appears to be a regression; it does not happen in
nightly-2024-02-18
, but happens innightly-2024-02-19
and later (therustc -Vv
version below)Lint Name
unused_imports
Reproducer
I tried this code, which (in the real code) has
std
-dependent functionality gated behind a feature:As of the
nightly-2024-04-19
toolchain, it now produces these errors when thestd
feature is enabled, complaining that thealloc
imports are redundant:I expected to see this happen:
No warning with the feature either enabled or disabled :)
The imports it is complaining about are redundant, in theory... we could put each and every import for something that is missing in the
no_std
prelude but present in thestd
one behind a#[cfg(feature = "std")]
. However: this feels bad, this looks bad, and until less than a week ago it was not requested by clippy. Therefore I suspect this is a regression.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: