Per instructions in cargo clippy --fix, posting a bug. The same bug shows up when using the latest 1.61.0-nightly (03a8cc7df 2022-02-21)
warning: failed to automatically apply fixes suggested by rustc to crate `geo`
after fixes were automatically applied the compiler reported errors within these files:
...
The following errors were reported:
error[E0505]: cannot move out of `edges_nearby_point` because it is borrowed
--> geo/src/algorithm/concave_hull.rs:153:55
```
warning: failed to automatically apply fixes suggested by rustc to crate `geo`
after fixes were automatically applied the compiler reported errors within these files:
* geo/src/algorithm/concave_hull.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/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[E0505]: cannot move out of `edges_nearby_point` because it is borrowed
--> geo/src/algorithm/concave_hull.rs:153:55
|
152 | let peeked_edge = edges_nearby_point.peek();
| ------------------------- borrow of `edges_nearby_point` occurs here
153 | let closest_edge_option = peeked_edge.map(|&edge| edges_nearby_point.fold(*edge, |acc, candidate| {
| --- ^^^^^^^ ------------------ move occurs due to use in closure
| | |
| | move out of `edges_nearby_point` occurs here
| borrow later used by call
error: aborting due to previous error
For more information about this error, try `rustc --explain E0505`.
Original diagnostics will follow.
warning: manual implementation of `Option::map`
--> geo/src/algorithm/concave_hull.rs:153:39
|
153 | let closest_edge_option = match peeked_edge {
| _______________________________________^
154 | | None => None,
155 | | Some(&edge) => Some(edges_nearby_point.fold(*edge, |acc, candidate| {
156 | | if closest_point.euclidean_distance(&acc)
... |
163 | | })),
164 | | };
| |_____________^
|
= note: `#[warn(clippy::manual_map)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
help: try this
|
153 ~ let closest_edge_option = peeked_edge.map(|&edge| edges_nearby_point.fold(*edge, |acc, candidate| {
154 + if closest_point.euclidean_distance(&acc)
155 + > closest_point.euclidean_distance(candidate)
156 + {
157 + *candidate
158 + } else {
...
warning: `geo` (lib) generated 1 warning
```
Per instructions in
cargo clippy --fix
, posting a bug. The same bug shows up when using the latest1.61.0-nightly (03a8cc7df 2022-02-21)
To reproduce:
Meta
rustc --version --verbose
:Full error report
``` warning: failed to automatically apply fixes suggested by rustc to crate `geo` after fixes were automatically applied the compiler reported errors within these files: * geo/src/algorithm/concave_hull.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/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[E0505]: cannot move out of `edges_nearby_point` because it is borrowed --> geo/src/algorithm/concave_hull.rs:153:55 | 152 | let peeked_edge = edges_nearby_point.peek(); | ------------------------- borrow of `edges_nearby_point` occurs here 153 | let closest_edge_option = peeked_edge.map(|&edge| edges_nearby_point.fold(*edge, |acc, candidate| { | --- ^^^^^^^ ------------------ move occurs due to use in closure | | | | | move out of `edges_nearby_point` occurs here | borrow later used by call error: aborting due to previous error For more information about this error, try `rustc --explain E0505`. Original diagnostics will follow. warning: manual implementation of `Option::map` --> geo/src/algorithm/concave_hull.rs:153:39 | 153 | let closest_edge_option = match peeked_edge { | _______________________________________^ 154 | | None => None, 155 | | Some(&edge) => Some(edges_nearby_point.fold(*edge, |acc, candidate| { 156 | | if closest_point.euclidean_distance(&acc) ... | 163 | | })), 164 | | }; | |_____________^ | = note: `#[warn(clippy::manual_map)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map help: try this | 153 ~ let closest_edge_option = peeked_edge.map(|&edge| edges_nearby_point.fold(*edge, |acc, candidate| { 154 + if closest_point.euclidean_distance(&acc) 155 + > closest_point.euclidean_distance(candidate) 156 + { 157 + *candidate 158 + } else { ... warning: `geo` (lib) generated 1 warning ```