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

Replace weird doc paragraph by compiler-checked must_use attribute #1801

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

jplatte
Copy link
Member

@jplatte jplatte commented Mar 2, 2023

Very lazy fix for making it harder to accidentally discard the Response generated by WebSocketUpgrade::on_upgrade. Feel free to improve by prodiving a message (#[must_use = "message"] or restoring a more useful version of the docs I deleted.

@jplatte jplatte requested a review from davidpdrsn March 2, 2023 12:14
@zombiepigdragon
Copy link

I don't think it's necessary to remove the comment, especially without adding a reason to the #must_use.

Also, is there anywhere else in Axum that this footgun can occur? I was planning to search for it and open a PR of my own later today before finding this, but since you've got a PR already it's probably worth checking out.

@jplatte
Copy link
Member Author

jplatte commented Mar 2, 2023

I found the paragraph I removed confusing. Otherwise I would not have removed it. Let's see what David thinks.

Also, I don't intend to update the PR to cover more places that could use a #[must_use], so if you want to investigate, don't let the existence of this PR stop you :)

axum/src/extract/ws.rs Outdated Show resolved Hide resolved
davidpdrsn and others added 2 commits March 3, 2023 09:41
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
@davidpdrsn davidpdrsn enabled auto-merge (squash) March 3, 2023 08:48
@davidpdrsn davidpdrsn merged commit 43883b8 into main Mar 3, 2023
@davidpdrsn davidpdrsn deleted the jplatte/ws-must-use branch March 3, 2023 08:54
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.

3 participants