Skip to content

Add #[must_use] to all async Future types#58

Open
ZXY595 wants to merge 1 commit into
agerasev:masterfrom
ZXY595:must-use-futures
Open

Add #[must_use] to all async Future types#58
ZXY595 wants to merge 1 commit into
agerasev:masterfrom
ZXY595:must-use-futures

Conversation

@ZXY595

@ZXY595 ZXY595 commented Jul 2, 2026

Copy link
Copy Markdown

Futures returned by AsyncConsumer / AsyncProducer methods do nothing unless .await-ed. Mistakenly dropping a future can silently lose items or block forever.

For example:

tx.push(value);

This line looks synchronous but actually returns a future, and there's no warning about this mistake.

This PR adds #[must_use] to:

Thanks for this great crate — async-ringbuf has been a pleasure to use!

Prevents silently dropping futures like tx.push(value) that look
synchronous but return an unawaited future. All 8 custom Future
types in AsyncProducer/AsyncConsumer traits are annotated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant