You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chore: Add witness hint for enum_variant_added lint (#1218)
Adds a witness hint for the `enum_variant_added` lint.
## Example
`enum_variant_added` outputs the following witness hint for the
`./test_crates/enum_variant_added/` test.
```rust
match value {
enum_variant_added::EnumWithNewVariant::OldVariant => (),
enum_variant_added::EnumWithNewVariant::OldStructVariant { .. } => (),
enum_variant_added::EnumWithNewVariant::OldTupleVariant(..) => (),
}
```
This compiles on the old version, but not on the new due to the lack of
exhaustiveness on the match cases. The lack of a catch-all case causes
the addition of a new variant to cause a compilation error.
## Commit Notes
+ Added witness hint for enum_variant_added
+ Added new parts to query for enum_variant_added to fetch relevant data
for the witness
+ Update test crates to allow for more exhaustive witness format testing
## Comments
Two questions and possible areas for bigger improvements:
1. Is there a better way to combine `baseline_variant_names` and
`baseline_variant_kinds`? They both form lists, but each list is
separate from the other. Now, each should still always form the same
length of list as the other, as they are tied to the same `variant`
query, but if there is a way to combine/tuple them together, that would
be good to know so I can make that adjustment.
2. Is it okay to modify tests like I've done here? It doesn't change the
final result of the test, it all runs the same, I just added some new
variants to the tested enum so that I can test the witness printing
unit-like, struct-like, and tuple-like enum variants.
description: "Lint `enum_variant_added` did not have the expected witness output.\nSee https://github.com/obi1kenobi/cargo-semver-checks/blob/main/CONTRIBUTING.md#testing-witnesses\nfor more information."
0 commit comments