-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Move [assertions_on_result_states
] to restriction
#9273
Conversation
r? @flip1995 (rust-highfive has picked a reviewer for you, use r? to override) |
Signed-off-by: tabokie <[email protected]>
I agree with these changes! @flip1995, the lint was added 10 days ago in #9225. If we merge it now, it won't make it on the beta branch, if I'm correct. Do we maybe want to do the change in rust-lang/rust or backport it later? (This is another place where nightly lints would be so helpful. It's on my todo list after |
We would need an out-of-cycle sync to get it into the rust repo before the release. I'm good with that, as long as it doesn't add too many other things (like new lints). We can also just do the |
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.
Only one comment, otherwise LGTM
@@ -96,3 +100,15 @@ fn has_debug_impl<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { | |||
.get_diagnostic_item(sym::Debug) | |||
.map_or(false, |debug| implements_trait(cx, ty, debug, &[])) | |||
} | |||
|
|||
fn is_unit_type(ty: Ty<'_>) -> bool { |
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.
Can't you call ty.is_unit() || ty.is_never()
instead of this function?
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.
Good idea. Was copying it from another older lint before.
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.
Oh which one? We should also fix it there... (not in this PR though.
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.
Here:
fn is_unit_type(ty: Ty<'_>) -> bool { |
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.
Are you motivated to fix it also there and open a PR for it? :)
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.
Sure, will fix it tomorrow.
Signed-off-by: tabokie <[email protected]>
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
move [`assertions_on_result_states`] to restriction "Backports" the first commit of rust-lang/rust-clippy#9273, so that the lint doesn't go into beta as a warn-by-default lint. The other changes in the linked PR can ride the train as usual. r? `@xFrednet` (only Clippy changes, so we don't need to bother compiler people) --- For Clippy: changelog: none
move [`assertions_on_result_states`] to restriction "Backports" the first commit of rust-lang/rust-clippy#9273, so that the lint doesn't go into beta as a warn-by-default lint. The other changes in the linked PR can ride the train as usual. r? ``@xFrednet`` (only Clippy changes, so we don't need to bother compiler people) --- For Clippy: changelog: none
move [`assertions_on_result_states`] to restriction "Backports" the first commit of rust-lang#9273, so that the lint doesn't go into beta as a warn-by-default lint. The other changes in the linked PR can ride the train as usual. r? ``@xFrednet`` (only Clippy changes, so we don't need to bother compiler people) --- For Clippy: changelog: none
Close #9263
This lint causes regression on readability of code and log output. And printing runtime values is not particularly useful for majority of tests which should be reproducible.
changelog: Move [
assertions_on_result_states
] to restriction and don't lint it for unit typeSigned-off-by: tabokie [email protected]