False Error with strum #[derive(Display)]: enum doesn't implement Display
See original GitHub issueEnvironment
- IntelliJ Rust plugin version: 0.4.170.4627-221
- Rust toolchain version: 1.60.0
- IDE name and version: CLion 2022.1.1
- Operating system: Windows 11
Problem description
After using strum to derive Display causes the IDE to report that enum does not implement the Display trait when trying to print it.
Steps to reproduce
This code compiles and runs correctly, yet reports an error both with and without external linter enabled.
[package]
name = "bugexample"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
strum = "0.24"
strum_macros = "0.24"
use strum_macros::Display;
#[derive(Display)]
enum Example {
VariantA,
VariantB
}
fn main() {
println!("{} {}", Example::VariantA, Example::VariantB);
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
strum - Rust - Docs.rs
Display , ToString : both derives print out the given enum variant. This enables you to perform round trip style conversions from enum...
Read more >Implementing fmt::Display for enum with fields - rust
The problem here is that your match arm binding f: &u32 shadows the value parameter f: &mut Formatter . So instead of passing...
Read more >strum - crates.io: Rust Package Registry
Strum is a set of macros and traits for working with enums and strings ... use std::string::ToString; #[derive(Display, Debug)] enum Color ...
Read more >How can I implement fmt::Display for Enum - Rust Users Forum
error[E0277 ]: `Day` doesn't implement `std::fmt::Display` ... #[derive(Debug)] enum Day { Saturday, Sunday ,Monday, Tuesday, Wednesday, Thursday, Friday }.
Read more >Procedural macros — list of Rust libraries/crates // Lib.rs
strum. Helpful macros for working with enums and strings ... A derive macro for implementing the display Trait via a doc comment and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It shouldn’t help in this case since the reasons differ. Cache invalidation may help in some weird situations when something stops working unexpectedly (for example, after upgrading). In some cases, it’s caused by cache corruption and, as a result, cache invalidation helps
The current example is about procedural macro support. And the support is not enabled by default for now @pedrofgodinho Try to enable
org.rust.cargo.evaluate.build.scripts
andorg.rust.macros.proc
experimental features to turn it on and reload the project model viaRefresh Cargo Projects
action. See #6908 for more detailsLet’s keep it open since procedural macro expansion is not enabled by default yet