You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⋊> lothrop@archimedes ⋊> ~/s/c/v0.3.14 on v0.3.14 ↑ cargo clippy --fix --bin "crack-voting" (base) 07:58:15
Checking crack-voting v0.3.14 (/home/lothrop/src/cracktunes.worktrees/v0.3.14/crack-voting)
warning: failed to automatically apply fixes suggested by rustc to crate crack_voting
after fixes were automatically applied the compiler reported errors within these files:
crack-voting/src/main.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the --broken-code flag
The following errors were reported:
error[E0599]: no method named awaitrun found for opaque type impl std::future::Future<Output = ()> in the current scope
--> crack-voting/src/main.rs:7:11
|
7 | run().awaitrun().await;
| ^^^^^^^^ method not found in impl Future<Output = ()>
error: aborting due to 1 previous error
For more information about this error, try rustc --explain E0599.
Original diagnostics will follow.
warning: unneeded return statement
--> crack-voting/src/main.rs:7:16
|
7 | run().await;
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: #[warn(clippy::needless_return)] on by default
help: remove return
|
7 | run().awaitrun().await;
| ~~~~~~~~~~~~
warning: crack-voting (bin "crack-voting") generated 1 warning (run cargo clippy --fix --bin "crack-voting" to apply 1 suggestion)
Finished dev profile [unoptimized + debuginfo] target(s) in 2.87s
Reproducer
I tried this code:
<code>
I expected to see this happen:
Instead, this happened:
Version
No response
Additional Labels
No response
The text was updated successfully, but these errors were encountered:
Don't warn on proc macro generated code in `needless_return`
Fixesrust-lang#13458Fixesrust-lang#13457Fixesrust-lang#13467Fixesrust-lang#13479Fixesrust-lang#13481Fixesrust-lang#13526Fixesrust-lang#13486
The fix is unfortunately a little more convoluted than just simply adding a `is_from_proc_macro`. That check *does* fix the issue, however it also introduces a bunch of false negatives in the tests, specifically when the returned expression is in a different syntax context, e.g. `return format!(..)`.
The proc macro check builds up a start and end pattern based on the HIR nodes and compares it to a snippet of the span, however that would currently fail for `return format!(..)` because we would have the patterns `("return", <something inside of the format macro>)`, which doesn't compare equal. So we now return an empty string pattern for when it's in a different syntax context.
"Hide whitespace" helps a bit for reviewing the proc macro detection change
changelog: none
Summary
⋊> lothrop@archimedes ⋊> ~/s/c/v0.3.14 on v0.3.14 ↑ cargo clippy --fix --bin "crack-voting" (base) 07:58:15
Checking crack-voting v0.3.14 (/home/lothrop/src/cracktunes.worktrees/v0.3.14/crack-voting)
warning: failed to automatically apply fixes suggested by rustc to crate
crack_voting
after fixes were automatically applied the compiler reported errors within these files:
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the
--broken-code
flagThe following errors were reported:
error[E0599]: no method named
awaitrun
found for opaque typeimpl std::future::Future<Output = ()>
in the current scope--> crack-voting/src/main.rs:7:11
|
7 | run().awaitrun().await;
| ^^^^^^^^ method not found in
impl Future<Output = ()>
error: aborting due to 1 previous error
For more information about this error, try
rustc --explain E0599
.Original diagnostics will follow.
warning: unneeded
return
statement--> crack-voting/src/main.rs:7:16
|
7 | run().await;
| ^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note:
#[warn(clippy::needless_return)]
on by defaulthelp: remove
return
|
7 | run().awaitrun().await;
| ~~~~~~~~~~~~
warning:
crack-voting
(bin "crack-voting") generated 1 warning (runcargo clippy --fix --bin "crack-voting"
to apply 1 suggestion)Finished
dev
profile [unoptimized + debuginfo] target(s) in 2.87sReproducer
I tried this code:
<code>
I expected to see this happen:
Instead, this happened:
Version
No response
Additional Labels
No response
The text was updated successfully, but these errors were encountered: