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

let_underscore_untyped with type _ #10441

Closed
dtolnay opened this issue Mar 3, 2023 · 3 comments
Closed

let_underscore_untyped with type _ #10441

dtolnay opened this issue Mar 3, 2023 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@dtolnay
Copy link
Member

dtolnay commented Mar 3, 2023

Summary

In light of #10411, it seems likely that folks would work around this lint by replacing let _ = ... with let _: _ = ....

However, that has all of the same downsides described in #6842. It's just a noisier / less clear way of writing the same thing. It would be better to require #[allow(clippy::let_underscore_untyped)] when someone wants to disregard this lint, rather than let _: _.

Lint Name

let_underscore_untyped

Reproducer

#![deny(clippy::pedantic)]

fn f() -> impl Fn() {
    || {}
}

fn main() {
    let _: _ = f();
}

Should trigger let_underscore_untyped, but does not.

Version

rustc 1.69.0-nightly (13471d3b2 2023-03-02)
binary: rustc
commit-hash: 13471d3b2046cce78181dde6cfc146c09f55e29e
commit-date: 2023-03-02
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7
@dtolnay dtolnay added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Mar 3, 2023
@dtolnay
Copy link
Member Author

dtolnay commented Mar 7, 2023

I suggested a possible generalization of this in #10463.

@blyxyas
Copy link
Member

blyxyas commented Apr 2, 2023

Should this issue be closed, as #10463 has been closed?

@dtolnay
Copy link
Member Author

dtolnay commented Apr 2, 2023

👍

@dtolnay dtolnay closed this as completed Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

2 participants