-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
warning: failed to automatically apply fixes suggested by rustc to crate `dispenser`
after fixes were automatically applied the compiler reported errors within these files:
* 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[E0597]: `instances.inner` does not live long enough
--> src/main.rs:53:25
|
46 | let instances = instances.lock().await.clone();
| --------- binding `instances` declared here
...
53 | for instance in instances.inner.iter() {
| ^^^^^^^^^^^^^^^ borrowed value does not live long enough
54 | / tokio::spawn(async move {
55 | | instance.lock().await.poll(poll_images).await;
56 | | });
| |______________- argument requires that `instances.inner` is borrowed for `'static`
57 | }
58 | }
| - `instances.inner` dropped here while still borrowed
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0597`.
Original diagnostics will follow.
warning: unnecessary use of `cloned`
--> src/main.rs:53:25
|
53 | for instance in instances.inner.iter().cloned() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove any references to the binding: `instances.inner.iter()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#unnecessary_to_owned
= note: `#[warn(clippy::unnecessary_to_owned)]` on by default
warning: `dispenser` (bin "dispenser") generated 1 warning (run `cargo clippy --fix --bin "dispenser"` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
Lint Name
unnecessary_to_owned
Reproducer
I tried this code:
<code>I saw this happen:
<output>
I expected to see this happen:
Version
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have