chore(deps): update rust crate derive_more to v1 - autoclosed #2625
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:
0.99.18
->1.0.0
Release Notes
JelteF/derive_more (derive_more)
v1.0.0
Compare Source
More than 8 years after the first commit and almost 5 years after the 0.99.0
release,
derive_more
has 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:
Debug
derive that can be used to easily customizeDebug
formatting.
Display
derive, which allows you to do anything thatthiserror
provides, but it worksfor any type not just errors. And by combining the
Display
derive with theError
andFrom
derives, there shouldn't really be any need to usethiserror
anymore (if you are missing a feature/behaviour fromthiserror
please report an issue).
Error
when an error occurs instead of a
&'static str
.use derive_more::SomeTrait
the actual trait is also importednot just the derive macro. This is especially useful for
Error
andDisplay
Breaking changes
std
feature which should be disabled inno_std
environments.std
, are now disabled by default. Thefull
feature can be used to get the old behavior of supporting all possible
derives.
TryFrom
,Add
,Sub
,BitAnd
,BitOr
,BitXor
,Not
andNeg
derives now return a dedicated error type instead of a
&'static str
onerror.
FromStr
derive now uses a dedicatedFromStrError
error type insteadof generating unique one each time.
Display
derive (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.
Debug
andDisplay
derives (and otherfmt
-like ones) now transparentlydelegate to the inner type when
#[display("...", (<expr>),*)]
attribute istrivially substitutable with a transparent call.
(#322)
DebugCustom
derive is renamed to justDebug
(gated now under a separatedebug
feature), and its semantics were changed to be a superset ofstd
variantof
Debug
.From
derive doesn't deriveFrom<()>
for enum variants without anyfields anymore. This feature was removed because it was considered useless in
practice.
From
derive now uses#[from(<types>)]
instead of#[from(types(<types>))]
and ignores field type itself.
Into
derive now uses#[into(<types>)]
instead of#[into(types(<types>))]
and ignores field type itself.
Into
derive now generates separate impls for each field whenever the#[into(...)]
attribute is applied to it. (#291)
Error
derive is updated with changes to theerror_generic_member_access
unstable feature for nightly users. (#200,
#294)
as_mut
feature is removed, and theAsMut
derive is now gated by theas_ref
feature. (#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
Display
derives. So now you can use:#[display(fmt = "Prefix: {field}")]
instead of needing to use#[display(fmt = "Prefix: {}", field)]
FromStr
derive support for enums that contain variants without fields.If you pass the name of the variant to
from_str
it will create the matchingvariant.
#[unwrap(owned, ref, ref_mut)]
attribute for theUnwrap
derive.By using them, it is possible to derive implementations for the reference types as well.
(#206)
TryUnwrap
derive similar to theUnwrap
derive. This one returns aResult
and does not panic.(#206)
Debug
derive with the same syntax asDisplay
derives.(#279)
derive_more::derive
module exporting only macros, without traits.(#290)
AsRef
/AsMut
derives.(#298)
TryFrom
derive for enums to convert from their discriminant.(#300)
#[inline]
attributes toIsVariant
andDebug
implementations.(#334
#[track_caller]
toAdd
,Mul
,AddAssign
andMulAssign
derives(#378
Changed
Constructor
andIsVariant
derives now generateconst fn
functions.IsVariant
are now marked#[must_use]
.(#350)
Unwrap
andIsVariant
derives 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.
syn
2.0.Error
derive now works in nightlyno_std
environmentsFixed
HashSet
in all derives, this is needed for rust analyzerto work correctly.
Provider
API for backtraces inError
derive.Error
derive not working withconst
generics.Box<dyn Error + Send + 'static>
IntoIterator
impls for generic structs.(#284)
Display
derive.(#297)
core
crate.(#327)
IsVariant
derive.{field:p}
do the expected thing in format strings forDisplay
andDebug
. Also document weirdness aroundPointer
formatting when usingexpressions, due to field variables being references.
(#381)
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, 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.