-
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
Don't lint let_unit_value
when needed for type inferenece
#8563
Conversation
r? @llogiq (rust-highfive has picked a reviewer for you, use r? to override) |
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 know which crates suffered this problem, but code-wise this looks good to me.
6bf3e41
to
ff0e654
Compare
☔ The latest upstream changes (presumably #8602) made this pull request unmergeable. Please resolve the merge conflicts. |
Sorry for letting this wait for so long, but I lack insight into actual cases in the wild, so I'm not sure if they are all caught However, as even if this misses some cases it is still a good improvement, r=me with a rebase. |
This will now handle block expression and branches when checking if type inference is needed. The only thing I can think of that would also be a false positive would be a something like: trait Foo {
type T;
fn get_t(&self) -> Self::T;
fn use_t(&self, _: T);
}
struct Bar;
impl Foo for Bar {
type T = ();
...
}
fn f(bar: Bar) {
let x = bar.get_t();
bar.use_t(x);
} But I'm pretty sure that already doesn't lint. |
a81ac09
to
4ec407c
Compare
☔ The latest upstream changes (presumably #8660) made this pull request unmergeable. Please resolve the merge conflicts. |
Ok, I might be offline for a while, but r+ when rebased. Thanks and again sorry for the wait. @bors delegate+ |
✌️ @Jarcho can now approve this pull request |
@bors r+ |
📌 Commit 70f7c62 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Currently, 'rustc_common_flags' lives in the top-level 'Makefile'. This means that we need to touch this whenever adjustments to Rust's CLI configuration are desired, such as changing what lints Clippy should emit. This patch moves these flags to a separate file within 'rust/' so that necessary changes can be made without affecting 'Makefile'. It copies the behavior currently used with 'bindgen_parameters', which accepts comments. Additionally, 'let_unit_value` is no longer specifically named as it is now part of the 'style' group [1]. [1]: rust-lang/rust-clippy#8563 Signed-off-by: Trevor Gross <tmgross@umich.edu>
fixes: #1502
Pinging @dtolnay. I think this is enough to fix the issue. Do you have a good list crates to test this on?
changelog: Don't lint
let_unit_value
when needed for type inference