-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add borrowed_reborrowable
lint
#164
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall some great stuff, thank you! I have a few comments, but nothing critical.
One more note, can we shorten the name? Maybe borrowed_reborrowable
(borrowed_commands
, borrowed_resource
, etc.)?
Sure thing! I'll change the name to |
428c708
to
cc9c4a9
Compare
28f8071
to
0161b02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall really good! Once all the outstanding comments are addressed, I'm cool to merge this!
Thank you for your hard work and patience :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran this over the Bevy engine source code and found this error:
warning: parameter takes `&mut ResMut` instead of a re-borrowed `ResMut`
--> crates/bevy_ecs/src/change_detection.rs:327:28
|
327 | fn set_changed(&mut self) {
| ^^^^^^^^^ help: use `ResMut` instead: `mut self: change_detection::ResMut<'w, T>`
...
661 | change_detection_mut_impl!(ResMut<'w, T>, T, Resource);
| ------------------------------------------------------ in this macro invocation
|
= note: `#[warn(bevy::borrowed_resource)]` on by default
Could you add a special case that skips self
parameters?
74b57fe
to
b86e281
Compare
Co-authored-by: BD103 <[email protected]>
Co-authored-by: BD103 <[email protected]>
b86e281
to
fb41fe4
Compare
This, following the [release checklist](https://github.com/TheBevyFlock/bevy_cli/blob/663298e1e24a6422abd001b6142dc53f371c3bcd/bevy_lint/docs/release.md), updates `bevy_lint` to v0.2.0-dev. I also added some missing information to the release checklist, based off of my experience releasing v0.1.0. Once this is merged, the feature freeze will be lifted, letting #164 and #173 be merged.
Fixes #127
Adds the pedantic
borrowed_reborrowable
lint to suggest that parameters using a mutable reference to a re-borrowable type instead switch to an owned instance of that type.See #127 for details.