-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added FORCED_RETURN
lint.
#3494
Conversation
Yup, that's more a thing for rustfmt
Looks like you re-used the existing
It looks fine as it is. I don't really mind either way, apart from Closures.
Generally we want to make the tests as simple as possible so that they are shorter and more readable. If allowing a lint helps with that, then it's fine. (as in this case) |
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.
just a nit regarding the documentation text
Better clarification in the docs. Ran `update_lints`.
Seems I'm not smart enough to run the tests locally before committing.
So. I read up on the RFC. Specifically relevant is this section
This lint is no semantic change, OK
Not useful to most rust programmers, OK
The motivation in the docs is lacking imo.
This is not making the language stricter, as any expression is still a value, only the return position is affected. It might fit under the hypothetical |
I could write something up if it helps?: I'm not sure if I should write it all up under |
Lints should be named after the thing they lint for, so this should be implicit-return or something, I think. |
Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`.
I added a check and test for replacing
resolves to:
Is that desirable or should I remove it? |
The additional text you suggested seems good. |
Added comment to explain usage of MIR.
This adds a new lint that warns if
return
is not used, which is the opposite ofclippy::needless_return
.Questions:
;
at the end? I thought that would be more a thing forrustfmt
.#[allow(clippy::needless_bool)]
and#[allow(clippy::match_bool)]
to the test to make it work properly. Other tests had it and others didn't, how should this be handled?Thanks.
Fixes #2685.