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
The standard library includes several types such as BoundedVec and HashMap which are only meant to be interacted with via their APIs. Allowing users to access and mutate fields directly can lead to them being in an invalid state.
Happy Case
We should add visibility for fields (private, public, pub(crate)) to control access to them.
A private field would also make the constructor of a type automatically private.
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered:
# Description
## Problem
Resolves#4837
Part of #4515
## Summary
This checks struct visibility in member access, constructors and
patterns.
## Additional Context
Private fields are still suggested in LSP. I plan to hide those fields
in a follow-up PR.
## Documentation
Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist
- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Problem
The standard library includes several types such as
BoundedVec
andHashMap
which are only meant to be interacted with via their APIs. Allowing users to access and mutate fields directly can lead to them being in an invalid state.Happy Case
We should add visibility for fields (private, public, pub(crate)) to control access to them.
A private field would also make the constructor of a type automatically private.
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: