rust-lang / rust-lang/rust-clippy
large_enum_variant triggered in error-chain macro has unhelpful help message
Open
Nobody has claimed this yet.
C-enhancement
E-medium
good first issue
T-middle
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
You know how I like to suggest E-hard new lints? Sorry, this time I only have an E-hard L-enhancement to report.
warning: large size difference between variants
--> src/main.rs:66:1
|
66 | / error_chain! {
67 | | foreign_links {
68 | | Io(::std::io::Error);
69 | | Handlebars(::handlebars::TemplateRenderError);
70 | | Yaml(::yaml::Error);
71 | | }
72 | | }
| |_^
|
= note: #[warn(large_enum_variant)] on by default
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.165/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
|
113| err : Box<$ foreign_link_error_path> ) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate
= issue author's remark: this help message is not helpful
Is there a way to (easily) print the enum variants with their sizes? This might be helpful even in rather obvious cases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the error_chain! reproducer at src/main.rs:66 and inspect how the large_enum_variant lint produces its help message. Determine what diagnostic information would make the enum variants and their sizes understandable, then verify that the resulting guidance addresses the reported macro case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100