Skip to content

[Feature Request] Derive trait recursively

Open

Description

Imagine you're in the following situation:

  • You need serde::Serialize implemented for a struct that doesn't already have it
  • This struct contains a lot of fields with lots of types from other crates in the workspace that also don't have serde::Serialize derived yet

You now have to spend minutes of your time clicking through to all of the different types and adding #[derive(Serialize)] to them (plus relevant imports).

What if Rust Analyzer could do this for us? There could be an assist on #[derive(Serialize)] for the top-level type that said "Derive recursively for all children" and went through and automatically did all of this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-assistsA-diagnosticsdiagnostics / error reportingdiagnostics / error reportingA-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-featureCategory: feature requestCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions