Update Rust crate derive_more to v2 #98
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
Test plan: CI should pass with updated dependencies. No review required: this is an automated dependency update PR.
Release Notes
JelteF/derive_more (derive_more)
v2.0.1Compare Source
Added
Playground will have all
derive_morefeatures available onceselectorscrate updates itsderive_moreversion.(#445)
v2.0.0Compare Source
Breaking changes
use derive_more::SomeTraitnow imports macro only. Importing macro withits trait along is possible now via
use derive_more::with_trait::SomeTrait.(#406)
#[display("...")]attribute on an enum now has defaulting behaviorinstead of replacing when no wrapping is possible (no
_variantplaceholder).(#395)
Fixed
Debugand
Displayexpansions.(#399)
unreachable_codewarnings on generated code when!(never type) is used.(#404)
TryFrom,TryIntoorFromStrwith an associated item called
ErrororErrrespectively.(#410)
#[display("...")]attribute on an enum being incorrectly treatedas transparent or wrapping.
(#395)
DebugandDisplayexpansions.(#431)
Debugexpansions.(#431)
#[display("...")]attribute on an enum not working transparentlyfor directly specified fields.
(#438)
DebugandDisplayexpansions.(#440)
v1.0.0Compare Source
More than 8 years after the first commit and almost 5 years after the 0.99.0
release,
derive_morehas finally reached its 1.0.0 release. This releasecontains a lot of changes (including some breaking ones) to make it easier to
use the derives and make it possible to extend them without having to break
backwards compatibility again. There are five major changes that I would like
to call out, but there are many more changes that are documented below:
Debugderive that can be used to easily customizeDebugformatting.
Displayderive, which allows you to do anything thatthiserrorprovides, but it worksfor any type not just errors. And by combining the
Displayderive with theErrorandFromderives, there shouldn't really be any need to usethiserroranymore (if you are missing a feature/behaviour fromthiserrorplease report an issue).
Errorwhen an error occurs instead of a
&'static str.use derive_more::SomeTraitthe actual trait is also importednot just the derive macro. This is especially useful for
ErrorandDisplayBreaking changes
stdfeature which should be disabled inno_stdenvironments.std, are now disabled by default. Thefullfeature can be used to get the old behavior of supporting all possible
derives.
TryFrom,Add,Sub,BitAnd,BitOr,BitXor,NotandNegderives now return a dedicated error type instead of a
&'static stronerror.
FromStrderive now uses a dedicatedFromStrErrorerror type insteadof generating unique one each time.
Displayderive (and otherfmt-like ones) now uses#[display("...", (<expr>),*)]syntax instead of#[display(fmt = "...", ("<expr>"),*)], and#[display(bound(<bound>))]instead of
#[display(bound = "<bound>")]. So without the double quotesaround the expressions and bounds.
DebugandDisplayderives (and otherfmt-like ones) now transparentlydelegate to the inner type when
#[display("...", (<expr>),*)]attribute istrivially substitutable with a transparent call.
(#322)
DebugCustomderive is renamed to justDebug(gated now under a separatedebugfeature), and its semantics were changed to be a superset ofstdvariantof
Debug.Fromderive doesn't deriveFrom<()>for enum variants without anyfields anymore. This feature was removed because it was considered useless in
practice.
Fromderive now uses#[from(<types>)]instead of#[from(types(<types>))]and ignores field type itself.
Intoderive now uses#[into(<types>)]instead of#[into(types(<types>))]and ignores field type itself.
Intoderive now generates separate impls for each field whenever the#[into(...)]attribute is applied to it. (#291)
Errorderive is updated with changes to theerror_generic_member_accessunstable feature for nightly users. (#200,
#294)
as_mutfeature is removed, and theAsMutderive is now gated by theas_reffeature. (#295)#[display("...")]attribute on an enum now requires the usageof
{_variant}to include the variant instead of including it at{}. Thereason is that
{}now references the first argument to the format string,just like in all other format strings. (#377)
Added
Displayderives. So now you can use:#[display(fmt = "Prefix: {field}")]instead of needing to use#[display(fmt = "Prefix: {}", field)]FromStrderive support for enums that contain variants without fields.If you pass the name of the variant to
from_strit will create the matchingvariant.
#[unwrap(owned, ref, ref_mut)]attribute for theUnwrapderive.By using them, it is possible to derive implementations for the reference types as well.
(#206)
TryUnwrapderive similar to theUnwrapderive. This one returns aResultand does not panic.(#206)
Debugderive with the same syntax asDisplayderives.(#279)
derive_more::derivemodule exporting only macros, without traits.(#290)
AsRef/AsMutderives.(#298)
TryFromderive for enums to convert from their discriminant.(#300)
#[inline]attributes toIsVariantandDebugimplementations.(#334
#[track_caller]toAdd,Mul,AddAssignandMulAssignderives(#378
Changed
ConstructorandIsVariantderives now generateconst fnfunctions.IsVariantare now marked#[must_use].(#350)
UnwrapandIsVariantderives now generate doc comments.#[automatically_derived]is now emitted from all macro expansions. Thisshould prevent code style linters from attempting to modify the generated
code.
syn2.0.Errorderive now works in nightlyno_stdenvironmentsFixed
HashSetin all derives, this is needed for rust analyzerto work correctly.
ProviderAPI for backtraces inErrorderive.Errorderive not working withconstgenerics.Box<dyn Error + Send + 'static>IntoIteratorimpls for generic structs.(#284)
Displayderive.(#297)
corecrate.(#327)
IsVariantderive.{field:p}do the expected thing in format strings forDisplayandDebug. Also document weirdness aroundPointerformatting when usingexpressions, due to field variables being references.
(#381)
v0.99.20Compare Source
v0.99.19Compare Source
v0.99.18Compare Source
syn2.0.Configuration
📅 Schedule: Branch creation - "on the 1st through 7th day of the month" in timezone America/Los_Angeles, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.