rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Fix let_unit_value to lint when explicit unit type annotation is present

Open matanshavit opened this issue 2 months ago • 7 comments

changelog: [let_unit_value]: Now lints when explicit unit type annotation is present

fixes rust-lang/rust-clippy#15957


This PR fixes the let_unit_value lint to trigger even when an explicit () type annotation is present.

matanshavit avatar Oct 28 '25 23:10 matanshavit

:warning: Warning :warning:

  • There are issue links (such as #123) in the commit messages of the following commits. Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.
    • b2809e411a34738876961c4502165ead1915753b

rustbot avatar Oct 28 '25 23:10 rustbot

r? clippy

Urgau avatar Oct 29 '25 07:10 Urgau

@samueltardieu

Error markers should be identical to the other one used for testing this lint (let_unit_value, not ERROR).

Fixed, that's for pointing that out.

please don't use lengthy LLM generated messages for the PR description, this is tedious to read and brings little value.

Understood. Sorry for the excess. I've shortened the description to just the changelog entry, reference to issue number, and short description.

matanshavit avatar Oct 30 '25 14:10 matanshavit

@Jarcho @samueltardieu @Urgau @blyxyas Could we please re-review the changes and consider merging?

matanshavit avatar Nov 29 '25 13:11 matanshavit

Hmm I'm not sure if this change is beneficial. This code was already allowed and it raised this issue https://github.com/rust-lang/rust-clippy/issues/12017, maybe it's better to lose this as a false negative, than to annoy users when it could be an important component for type-ensurance.

blyxyas avatar Dec 01 '25 18:12 blyxyas

Reminder, once the PR becomes ready for a review, use @rustbot ready.

rustbot avatar Dec 01 '25 18:12 rustbot