Skip to content

Conversation

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Sep 4, 2025

Rain mentioned during their RustConf talk that it is easy to accidentally discard a Future before awaiting it when it is wrapped in a Result that you wish to ignore.

let _ = futurelike();

It generally makes sense that there are many reasons to ignore a Result, but fewer to ignore a future; so enabling it as a restriction lint seems useful for codebases that are heavily async.

This lint isn't correct yet: I'm not sure if we should lint on Result<Future>, Future<Result>, both, or those types + options.

Open q on naming: discarded_futures or discarded_future?

  • Followed lint naming conventions
  • Added passing UI tests (including committed .stderr file)
  • cargo test passes locally
  • Executed cargo dev update_lints
  • Added lint documentation
  • Run cargo dev fmt

changelog: [discarded_future]: new lint

Summary Notes

Managed by @rustbot—see help for details

@github-actions
Copy link

github-actions bot commented Sep 4, 2025

No changes for fbbaa0e

@rustbot rustbot added S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work A-lint Area: New lints labels Sep 4, 2025
@Manishearth
Copy link
Member Author

https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_future

@Manishearth Manishearth closed this Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lint Area: New lints S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants