Skip to content
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

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

tabokie
Copy link
Contributor

@tabokie tabokie commented Aug 1, 2022

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 type

Signed-off-by: tabokie [email protected]

@rust-highfive
Copy link

r? @flip1995

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 1, 2022
@xFrednet
Copy link
Member

xFrednet commented Aug 1, 2022

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 lint_reasons has been stabilized 😅 )

@flip1995
Copy link
Member

flip1995 commented Aug 1, 2022

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 restriction move in the Rust repo and let the other changes in this PR ride the train. That way, we don't need a sync.

Copy link
Member

@flip1995 flip1995 left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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 {

Copy link
Member

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? :)

Copy link
Contributor Author

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.

@flip1995
Copy link
Member

flip1995 commented Aug 1, 2022

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Aug 1, 2022

📌 Commit 48ad9d8 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 1, 2022

⌛ Testing commit 48ad9d8 with merge a5a6c95...

@bors
Copy link
Contributor

bors commented Aug 1, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing a5a6c95 to master...

@bors bors merged commit a5a6c95 into rust-lang:master Aug 1, 2022
@tabokie tabokie deleted the assert_ok_fp branch August 1, 2022 12:33
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 2, 2022
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 2, 2022
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
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 11, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assertions_on_result_states leads to less clear tests
5 participants