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

Lint: Removal of a field in a enum struct variant #153

Closed
obi1kenobi opened this issue Oct 17, 2022 · 0 comments · Fixed by #156
Closed

Lint: Removal of a field in a enum struct variant #153

obi1kenobi opened this issue Oct 17, 2022 · 0 comments · Fixed by #156
Labels
A-lint Area: new or existing lint E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.

Comments

@obi1kenobi
Copy link
Owner

obi1kenobi commented Oct 17, 2022

For example:

pub enum Foo {
    Bar {
        a: usize,
        b: u64,
    }
}

Removing e.g. the b field here is a breaking change.

The fields of struct variants always have "default" visibility, just like variants themselves: they inherit the visibility of the enum itself.

This lint is similar to lints checking for removal of pub fields in structs and for checks over enum variants.

It may require a small amount of new schema and adapter code: currently the schema for StructVariant doesn't have a field edge like Struct does, and probably should have one. I believe the type of struct variant fields should still be StructField.

@obi1kenobi obi1kenobi added A-lint Area: new or existing lint E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue. labels Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: new or existing lint E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant