Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
Oh clever. Yeah, this will catch the "I forget to call run" problem that beginners hit sometimes!
It won't help with that, sadly :( App::new();Not worth adding in my opinion. Unless, there's some other example in which this helps, @doonv? |
Yeah unfortunately there's not much you can do about that apart from making Making |
|
Would be good to add must_use in |
|
prior work #5395 |
|
bors r+ |
I'm pretty sure this is wrong. Since nearly all I tested this out with a very simple example: my-bevy/src/lib.rs #[must_use]
pub struct MyBuilder;
impl MyBuilder {
pub fn new() -> Self {
Self
}
pub fn a(self) -> Self {
self
}
pub fn b(self) -> Self {
self
}
pub fn c(self) -> Self {
self
}
}my-bin/src/main.rs use my_bevy::MyBuilder;
fn main() {
MyBuilder::new().a().b().c();
}This still gives me warnings about my unused Edit: Therefore, App should also give the same warnings with this PR. |
|
The methods on Adding |
Objective
Make it harder to use
Appincorrectly.Solution
Add the
#[must_use]attribute toApp, this prevents you from creating anAppand not using it.Changelog
#[must_use]attribute toApp.