Use derive_more::{Display, Error} for error messages #39
No reviewers
Labels
No labels
breaking
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
worm-blossom/willow_rs!39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "aecsocket/willow_rs:feat/derive-display"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Removes manual
impl Displayandimpl Errorblocks, replacing them withderive_more's (no_std compatible).Massively reduces maintenance burden for implementing Display and Error on new error types!
Changes error messages to match the Rust API spec, from https://rust-lang.github.io/api-guidelines/interoperability.html?highlight=error#examples-of-error-messages:
This includes error messages and
expectmessages. Also added backticks around code elements in messages - nitpicky, but I'm precise.Uses
workspace.dependenciesto share thederive_moredep between crates, can be changed to explicitly include the same dep in each subcrate tho.You could use different crates like snafu, thiserror, etc. derive_more is my personal choice, since it includes a bunch more derivable traits, so it's nice for convenience if you want to derive more stuff later.
derive_more::{Display, Error}for error messages 4a1ec166c7DisplayandErrorimpls #21Jup, this looks good, thank you.
I opened an issue over on bab_rs to do things the same way in that crate as well.