Skip to content
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

chore: add a witness for enum_variant_missing #978

Merged
merged 8 commits into from
Oct 18, 2024

Conversation

CommanderStorm
Copy link
Contributor

@CommanderStorm CommanderStorm commented Oct 18, 2024

Similar to #977 (but a bit more wrong syntax gets produced)

Similar to , this is not quite correct syntax:
a query for variant would be nessesary to have the correct brackets to construct the enum (struct, vs plain vs tuple).

@obi1kenobi
Copy link
Owner

In this case, I think it's worth getting the variant kind right.

We can tweak the lint query by adding kind: __typename @output on the original variant which will say if it's plain / tuple / struct, and then use either no extra notation, or (...), or { ... } accordingly. The templating language should be powerful enough to support such an addition.

Also, it seems like the PR title got cut off maybe?

@CommanderStorm CommanderStorm changed the title chore: made sure that enum_variant_missing chore: add a whitness for enum_variant_missing Oct 18, 2024
@CommanderStorm
Copy link
Contributor Author

Shure. Please review, if I picked the correct query (=you did not mean witness.witness_query)

(I have also added a testcase to prove that it works)

@CommanderStorm CommanderStorm changed the title chore: add a whitness for enum_variant_missing chore: add a witness for enum_variant_missing Oct 18, 2024
Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff. Still a few nitpicks that I'd like you to try to catch on your own in future PRs, either up front or in self-review, though.

src/lints/enum_variant_missing.ron Outdated Show resolved Hide resolved
test_crates/enum_variant_missing/old/src/lib.rs Outdated Show resolved Hide resolved
test_outputs/witnesses/enum_variant_missing.snap Outdated Show resolved Hide resolved
@obi1kenobi obi1kenobi enabled auto-merge (squash) October 18, 2024 02:20
@CommanderStorm CommanderStorm marked this pull request as draft October 18, 2024 02:25
auto-merge was automatically disabled October 18, 2024 02:25

Pull request was converted to draft

@CommanderStorm CommanderStorm marked this pull request as ready for review October 18, 2024 02:30
@obi1kenobi obi1kenobi enabled auto-merge (squash) October 18, 2024 02:30
@obi1kenobi
Copy link
Owner

I'm happy to merge this once CI is happy with it again.

auto-merge was automatically disabled October 18, 2024 08:20

Head branch was pushed to by a user without write access

@obi1kenobi obi1kenobi merged commit 4ca3198 into obi1kenobi:main Oct 18, 2024
35 checks passed
@CommanderStorm CommanderStorm deleted the whitness-enum-variant branch October 18, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants