-
Notifications
You must be signed in to change notification settings - Fork 8
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 must use annotation to functions that have no mutable args or statics #145
add must use annotation to functions that have no mutable args or statics #145
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.
After discussing this PR with @edmorley, I remove my approve. Adding must_use
makes sense, but we need to go further than just slapping annotations on anything where static analysis can figure out the value needs to be used.
We most likely want to add messages to most of them too.
pub fn build(self) -> BuildResult { | ||
BuildResult(InnerBuildResult::Pass { | ||
launch: self.launch, | ||
store: self.store, | ||
}) | ||
} | ||
|
||
#[must_use] |
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 don't think #[must_use]
should be used on this function and the one below given they do mutate the original struct - seems like false positives. (Unless we want to enforce the chaining function style of using these builders - which may actually be what we want, but worth discussing.)
Fixing this lint is definitely one where we need to vet each case and not just add the annotations where clippy suggested without checking :-)
I found some guidelines on when to use |
Should we close this PR and continue discussion in the issue itself, or create a new one? This PR will not be merged anytime soon and with a very different changeset, correct? |
I think we should close this for now, and discuss in the issue what strategy we wish to use here before opening a new PR. |
https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
Fixes #57