-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Clippy generating non-user-code warning when using generator implemented futures. #5360
Comments
A solution could be to apply |
(Just passing through) This warning appears reasonable to me. If I understand it correctly, it is caused by foo not actually making use of any async function. Hence there is no point in declaring it async. |
That's not correct, the lint is triggering due to the generator code that is used to implement async/await, that code uses a variable that starts with an underscore. My proposed fix would be to remove the underscore, and allow the warning that would trigger if that variable was never used. |
Did you raise this on the main rust repo? If not, do that and cc jonas-schievink. Asking for it in the clippy repo will not help. |
I did do that, it was moved here for some reason though. |
@jonas-schievink I know you intentionally made it |
While I did mainly choose Doesn't Clippy already ignore macro- and lowering-generated code in some lints? If so, why not ensure and test that all lints do this? |
Yeah, this is definitely a Clippy bug, not a rustc bug. The fix is pretty easy. Just add a check if this comes from an await expansion. |
As long as it continues to fire for something like |
When the user uses a retrieval request, like getting a user by ID, the future output is a `Result<Option<T>>`. The code to handle 404 response status codes didn't actually exist, so it'd always either be `Ok(Some(T))` or `Err(E)`. This patch adds support for handling 404 responses and returning `Ok(None)` where encountered on select retrieval routes. Here's an example of output: ``` Getting guild member for user 1 Ok(None) Getting guild member for user 640434332485287936 Ok(Some(Member { deaf: false, guild_id: None, hoisted_role: Non..... ``` Closes #157. Approved-by: AEnterprise <aenterprise@aenterprise.info> Approved-by: Valdemar Erk <valdemar@erk.io> Merged-by: Valdemar Erk <valdemar@erk.io> Signed-off-by: Vivian Hellyer <vivian@hellyer.dev>
For anyone subscribed to this issue, this fix was released in today's stable 1.45.0 release. |
…2983) rust-lang/rust-clippy#5360 was resolved a while back. [ci skip-build-wheels]
I ran this code under Clippy:
I expected to see this happen: no lints generated.
Instead, this happened: Clippy produced this lint:
If you want to reproduce, you can use the Clippy tool on the playground here: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=d343f2d15d5de2e2ac222c73a9680a0b
The text was updated successfully, but these errors were encountered: