Skip to content

Don't trigger let_underscore_future when the type is specified#17247

Open
mistaste wants to merge 1 commit into
rust-lang:masterfrom
mistaste:fix-let-underscore-future-explicit-type
Open

Don't trigger let_underscore_future when the type is specified#17247
mistaste wants to merge 1 commit into
rust-lang:masterfrom
mistaste:fix-let-underscore-future-explicit-type

Conversation

@mistaste

@mistaste mistaste commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #16991.

let_underscore_future fired even when the discarded value had an explicit type
annotation:

let _: Pin<Box<dyn Future<Output = ()>>> = Box::pin(some_async_fn());

Writing the type already shows intent, and the mem::drop suggestion is noisier
here. This makes let_underscore_future a strict subset of let_underscore_untyped
by only firing when no type is given (matching how let_underscore_untyped itself
is gated on local.ty.is_none()).

changelog: [let_underscore_future]: no longer fires when the let _ binding has an explicit type annotation

`let _: T = future;` already shows intent through the explicit type
annotation, so it should not be linted (mirroring `let_underscore_untyped`,
which only fires when no type is given).
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 14, 2026
@rustbot

rustbot commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @samueltardieu (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 8 candidates
  • 8 candidates expanded to 8 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@rustbot

rustbot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17213) made this pull request unmergeable. Please resolve the merge conflicts.

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.

let_underscore_future should not trigger if type of discarded value specified

3 participants