Skip to content

feat(derive) fields derive visibility from original struct - #27

Merged
aapoalas merged 2 commits into
mainfrom
derive_field_vis
Sep 22, 2025
Merged

feat(derive) fields derive visibility from original struct#27
aapoalas merged 2 commits into
mainfrom
derive_field_vis

Conversation

@Reinsdyret

Copy link
Copy Markdown
Collaborator

Fields now derive the visibility from original structs, instead of just pub.

@Reinsdyret

Copy link
Copy Markdown
Collaborator Author

@aapoalas @omfj I'm unsure about the linting errors here, why didnt these trigger before?
Should I add ignores for all the errors?

@Reinsdyret
Reinsdyret requested a review from aapoalas September 19, 2025 08:05
@aapoalas

Copy link
Copy Markdown
Member

@aapoalas @omfj I'm unsure about the linting errors here, why didnt these trigger before? Should I add ignores for all the errors?

They weren't triggering because the fields were all public and the type was public, so in a library it meant that they could be used by users of the library. Now that we've made them private (inaccessible to users of the library), the linter can see that the fields are never accessed here in the library and they cannot be accessed from the outside. Hence, they are not unused and could be removed.

We should add #[expect(dead_code)] I think (or #[allow(...)] but expect is stronger and thus generally better).

@Reinsdyret

Reinsdyret commented Sep 22, 2025

Copy link
Copy Markdown
Collaborator Author

We should add #[expect(dead_code)] I think (or #[allow(...)] but expect is stronger and thus generally better).

I've tried adding expect or allow on the structs and on all fields and errors persist. I think its from the -D warnings in clippy, we can add -A dead_code to allow dead code warnings but i dont know any other solution

@aapoalas

aapoalas commented Sep 22, 2025

Copy link
Copy Markdown
Member

We should add #[expect(dead_code)] I think (or #[allow(...)] but expect is stronger and thus generally better).

I've tried adding expect or allow on the structs and on all fields and errors persist. I think its from the -D warnings in clippy, we can add -A dead_code to allow dead code warnings but i dont know any other solution

Try adding the #[allow(dead_code)] at the top level of the integration.rs and then in the other "scopes" where the linter is complaining.

EDIT: Actually no wait: it's best if we just add #[allow(dead_code)] in the output of the SoAble derive. Each of the generated Ref/Mut/Slice/SliceMut types should be marked with #[allow(dead_code)], as we generate them regardless of if they're used.

@aapoalas
aapoalas merged commit 7aba0c7 into main Sep 22, 2025
3 checks passed
@aapoalas
aapoalas deleted the derive_field_vis branch September 22, 2025 19:23
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