-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
unused_parens now fires on cast expression #110189
unused_parens now fires on cast expression #110189
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
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.
Some nits, but LGTM.
Also you shouldn't have any changes in submodules here.
This comment has been minimized.
This comment has been minimized.
920f651
to
8488fd0
Compare
(force-pushed to drop accidental changes in stdarch submodule) should it be fixed in this PR as well as other occurrences? |
@KisaragiEffective I'd suggest doing so if it isn't against the reviewer's descretion since that'll be the only way the CI passes and the compiler builds fully :) |
submitted rust-lang/stdarch#1411, marking this as a draft until it is synced. |
This comment has been minimized.
This comment has been minimized.
It's merged 🚀 |
Can you please squash your commits? |
Sure! However, I'd like to rebase (and squash) after stdarch update is landed in order to reduce force-push, so I'll submit another PR first. |
submitted #110285, this PR remains to be a draft. Once it has approved and merged, I will rebase and squash commit. |
☔ The latest upstream changes (presumably #110458) made this pull request unmergeable. Please resolve the merge conflicts. |
…Amanieu stdarch: update submodule We need [this commit](rust-lang/stdarch@cf3deea) introduced by [stdarch#1411](rust-lang/stdarch#1411) in order to merge rust-lang#110189.
…anieu stdarch: update submodule We need [this commit](rust-lang/stdarch@cf3deea) introduced by [stdarch#1411](rust-lang/stdarch#1411) in order to merge rust-lang#110189. Note to myself: `git pull && git submodule update --remote library/stdarch`
8488fd0
to
1810b24
Compare
56f75aa
to
04f6320
Compare
This comment has been minimized.
This comment has been minimized.
It looks like another PR to stdarch is needed. |
@@ -198,7 +198,7 @@ fn casts() { | |||
assert_eq::<i32>(f32::INFINITY as i32, i32::MAX); | |||
assert_eq::<i32>(f32::NEG_INFINITY as i32, i32::MIN); | |||
assert_eq::<i32>(f32::NAN as i32, 0); | |||
assert_eq::<i32>((-f32::NAN) as i32, 0); |
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 we should lint against (-expr) as i32
. Looking at -expr as i32
I have no idea whether the as
or the -
are executed first, and I might care about that (in particular when casting to an unsigned type). (The formatting indicates that -
goes first but I don't know if that actually matches how this is parsed.)
Parentheses to disambiguate parsing precedence are a good thing, we should not steer people away from them.
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 agreed :)
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.
Thanks! The diff in the Miri test can hopefully be removed then. :)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
// cast is left-assoc | ||
let _ = (true as u8) as u16; | ||
//~^ WARN unnecessary parentheses around cast expression | ||
// should not fire |
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.
Please add unary -
to this block (and other unary operator as well?)
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.
Does your intention include *expr as Ty
and &expr as Ty
?
☔ The latest upstream changes (presumably #113151) made this pull request unmergeable. Please resolve the merge conflicts. |
@KisaragiEffective any updates on it? |
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |
close rust-lang/rust-clippy#10557.
close rust-lang/rust-clippy#10625.
@llogiq suggested submit PR to solve the issue.