-
Notifications
You must be signed in to change notification settings - Fork 385
Open
Labels
bugsubsystem::cfgIssues related to conditional compilation (processing of `cfg` attributes)Issues related to conditional compilation (processing of `cfg` attributes)subsystem::code insightGeneral label for issues related to code understanding: highlighting, completion, annotation, etc.General label for issues related to code understanding: highlighting, completion, annotation, etc.subsystem::highlightingIssues related to code highlightingIssues related to code highlighting
Description
Environment
- IntelliJ Rust plugin version:
0.4.185.5086-223
- Rust toolchain: on
nightly
,stable
,1.65.0
, pretty much every version I try - IDE name and version: Clion
#CL-223.7571.171
- Operating system: Manjaro (rolling latest with kernel
5.15.78
)
Problem description
When using an enum that is populated using feature flags, and there is only a single entry, matching for that entry incorrectly reports that there are uncaught cases. Adding a _ => unreachable!()
clause as suggested by clion to the match then causes clippy and check to error that it's unreachable code because the enum only has a single type.
Steps to reproduce
Using libp2p::identity::Keypair
:
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum Keypair {
/// An Ed25519 keypair.
Ed25519(ed25519::Keypair),
/// An RSA keypair.
#[cfg(all(feature = "rsa", not(target_arch = "wasm32")))]
Rsa(rsa::Keypair),
/// A Secp256k1 keypair.
#[cfg(feature = "secp256k1")]
Secp256k1(secp256k1::Keypair),
/// An ECDSA keypair.
#[cfg(feature = "ecdsa")]
Ecdsa(ecdsa::Keypair),
}
And the match on Keypair
with no features enabled on it:
match self {
Keypair::Ed25519(keypair) => { println!("{keypair:?}") }
}
qti3e
Metadata
Metadata
Assignees
Labels
bugsubsystem::cfgIssues related to conditional compilation (processing of `cfg` attributes)Issues related to conditional compilation (processing of `cfg` attributes)subsystem::code insightGeneral label for issues related to code understanding: highlighting, completion, annotation, etc.General label for issues related to code understanding: highlighting, completion, annotation, etc.subsystem::highlightingIssues related to code highlightingIssues related to code highlighting