-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop exporting traits by default and early 2.0 release #405
Comments
@JelteF I do still lean towards the feedback I was giving during 1.0.0-beta.* cycles and consider this as unpleasant breakage, yet leading to the better code. Most of the people's complaints are just a result of their inertia to adapt and getting used to old ways, imho. Allowing to mix up However, it seems that I'm in minority here.
I'm totally OK if we swap them. The name I propose
This is also the case to address the problem with mixed |
I do agree with you that it's an anti-pattern, but I don't think it's derive_more it's place to get people to avoid this anti-pattern. Also as long as you fully qualify the error trait it's not a big problem without derive_more, but as soon as you then import the Error derive you either have to use
Alright, lets do this then. And indeed |
As an outsider, I really question benefit of even including a Across all my projects, both public and private, the change to 1.0.0 did not save even a single import line where trait methods were being used. It did save a couple (<10) of lines where I had both manual and derived implementations of the same trait in the same file, but that was fairly uncommon. I would not choose to import |
As was decided in #405, the crate's root should re-export only macros. Re-exporting of macros along with their corresponding traits should be moved to `with_trait` module. Co-authored-by: Jelte Fennema-Nio <[email protected]>
The amount of opened issues and negative feedback raised because we export traits together with derives by default in 1.0 is much larger than I had expected. So I'm left wondering if we made the right decision here, and if the downsides are worth the upsides.
The downsides I'm seeing are:
Benefits:
I think the following reddit comment made good points on why this is the possibly the wrong tradeoff. tl;dr people familiar with rust are used to the errors of not having imported an std trait, and rust-analyzer helps solve these issues easily. But these conflicting import errors have are uncommon, and thus a hassle to solve especially because there's no tooling to fix them automatically.
Source: https://www.reddit.com/r/rust/comments/1emi4fi/comment/lhkmjpk/
Right now I'm definitely leaning towards the feeling of: "If I could go back in time, I think we should not have made this change".
The question then becomes, how can we make changing this back as painless as possible, now that we have made this "mistake".
The best approach I can see is by doing the following:
derive_more::both
orderive_more::trait_derive
that people already on 1.0 can use.Related to:
derive_more::Error
macro collides with localError
enum, whereasthiserror
is fine. #401The text was updated successfully, but these errors were encountered: