#[deriving(PartialEq, Eq, Show, Clone, Hash, PartialOrd, Ord, Default, Encodable, Decodable)] is too verbose
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
If I have a small struct wrapping some basic types, or a basic enum, it's quite likely that the entire list of traits above is appropriate to derive (with the possible exception of Default). However, this is so noisy that, in practice, nobody seems to do so, including in the main Rust repository: for example, grep libsyntax for pub enum and look at how many of them cannot be used as keys in maps or even Shown. Instead, some random subset of traits is derived depending on what people actually need to do with the struct. But this is annoying:
- If I need to add a new trait, it's usually a completely meaningless busywork change.
- If the type is a public item from someone else's library, then I can't add a deriving, but would have to make a copy of the type and manually convert values back and forth in order to do whatever the trait is for. I haven't actually encountered this yet, but then again I haven't written that much code..
The most obvious solution would be a shortcut to derive as many traits as possible, though I'm not sure how that would interact with new derivable traits potentially being added in the future.
Contributor guide
No contributing guide indexed for this repository
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 by evaluating the proposed shortcut for deriving the listed traits and how it should behave when new derivable traits are added. The issue names no files or tests; done would require a settled design that addresses public library types and future trait additions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100