Skip to content

large_enum_variant triggered in error-chain macro has unhelpful help message #2121

@killercup

Description

@killercup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions