Feature Request
Derive entry per crate
Summary
Introduce separate derive macro entries grouped by their originating crate. Instead of combining all derives into a single attribute, derives would be organized into multiple #[derive(...)] blocks based on the crate they come from.
Motivation
Grouping derives by crate improves both readability and maintainability of the code. When derives from different ecosystems (e.g., serialization, archiving, standard traits) are separated, it becomes immediately clear which functionality is provided by which dependency.
This structure also makes it easier to:
- Navigate and audit dependencies: Developers can quickly identify which crate is responsible for specific derives.
- Modify or remove functionality: Adjusting or removing derives tied to a specific crate becomes straightforward without affecting unrelated ones.
- Reduce cognitive load: Large, mixed derive lists can be difficult to scan; grouping them provides a more structured and predictable layout.
- Improve consistency in larger codebases: Enforcing crate-based grouping encourages a standardized style across teams and projects.
Overall, this change promotes clearer intent, better organization, and easier long-term maintenance, especially in projects that rely on multiple derive-heavy libraries.
Related configuration options
merge_derives
Examples
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] // Rkyv derives
#[derive(serde::Serialize, serde::Deserialize)] // Serde derives
#[derive(Debug, Clone)] // Built-in derives
pub struct Donation {
verification_token: Uuid,
message_id: Uuid,
}
Feature Request
Derive entry per crate
Summary
Introduce separate derive macro entries grouped by their originating crate. Instead of combining all derives into a single attribute, derives would be organized into multiple #[derive(...)] blocks based on the crate they come from.
Motivation
Grouping derives by crate improves both readability and maintainability of the code. When derives from different ecosystems (e.g., serialization, archiving, standard traits) are separated, it becomes immediately clear which functionality is provided by which dependency.
This structure also makes it easier to:
Overall, this change promotes clearer intent, better organization, and easier long-term maintenance, especially in projects that rely on multiple derive-heavy libraries.
Related configuration options
merge_derives
Examples