Fixed issue with derive_more Display Implementations (#16298)

# Objective

- Fixed issue where `thiserror` `#[error(...)]` attributes were
improperly converted to `derive_more` `#[display(...)]` equivalents in
certain cases with a tuple struct/enum variant.

## Solution

- Used `re/#\[display\(.*\{[0-9]+\}.*\)\]/` to find occurences of using
`{0}` where `{_0}` was intended (checked for other field indexes too)and
updated accordingly.

## Testing

- `cargo check`
- CI

## Notes

This was discovered by @dtolnay in [this
comment](https://github.com/bevyengine/bevy/pull/15772#discussion_r1833730555).
This commit is contained in:
Zachary Harrold 2024-11-09 07:29:52 +11:00 committed by GitHub
parent 61d4048acb
commit d143da338a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -1961,13 +1961,13 @@ pub enum ScheduleBuildError {
#[display("System dependencies contain cycle(s).\n{_0}")] #[display("System dependencies contain cycle(s).\n{_0}")]
DependencyCycle(String), DependencyCycle(String),
/// Tried to order a system (set) relative to a system set it belongs to. /// Tried to order a system (set) relative to a system set it belongs to.
#[display("`{0}` and `{_1}` have both `in_set` and `before`-`after` relationships (these might be transitive). This combination is unsolvable as a system cannot run before or after a set it belongs to.")] #[display("`{_0}` and `{_1}` have both `in_set` and `before`-`after` relationships (these might be transitive). This combination is unsolvable as a system cannot run before or after a set it belongs to.")]
CrossDependency(String, String), CrossDependency(String, String),
/// Tried to order system sets that share systems. /// Tried to order system sets that share systems.
#[display("`{0}` and `{_1}` have a `before`-`after` relationship (which may be transitive) but share systems.")] #[display("`{_0}` and `{_1}` have a `before`-`after` relationship (which may be transitive) but share systems.")]
SetsHaveOrderButIntersect(String, String), SetsHaveOrderButIntersect(String, String),
/// Tried to order a system (set) relative to all instances of some system function. /// Tried to order a system (set) relative to all instances of some system function.
#[display("Tried to order against `{0}` in a schedule that has more than one `{0}` instance. `{_0}` is a `SystemTypeSet` and cannot be used for ordering if ambiguous. Use a different set without this restriction.")] #[display("Tried to order against `{_0}` in a schedule that has more than one `{_0}` instance. `{_0}` is a `SystemTypeSet` and cannot be used for ordering if ambiguous. Use a different set without this restriction.")]
SystemTypeSetAmbiguity(String), SystemTypeSetAmbiguity(String),
/// Systems with conflicting access have indeterminate run order. /// Systems with conflicting access have indeterminate run order.
/// ///

View file

@ -248,7 +248,7 @@ pub(crate) enum ConvertAttributeError {
"Vertex attribute {_0} has format {_1:?} but expected {_3:?} for target attribute {_2}" "Vertex attribute {_0} has format {_1:?} but expected {_3:?} for target attribute {_2}"
)] )]
WrongFormat(String, VertexFormat, String, VertexFormat), WrongFormat(String, VertexFormat, String, VertexFormat),
#[display("{0} in accessor {_1}")] #[display("{_0} in accessor {_1}")]
AccessFailed(AccessFailed, usize), AccessFailed(AccessFailed, usize),
#[display("Unknown vertex attribute {_0}")] #[display("Unknown vertex attribute {_0}")]
UnknownName(String), UnknownName(String),