Description
This code triggers the following suggestion:
error: use Vec::sort_by_key here instead
--> src/report/mod.rs:223:5
|
223 | crates.sort_unstable_by(|a, b| a.id().cmp(&b.id()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `crates.sort_unstable_by_key(|&a| a.id())`
|
= note: `-D clippy::unnecessary-sort-by` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
However, the suggested code does not work: &a
is rejected as a pattern, it says I "cannot move out of a shared reference". using just a
for the closure argument works.
Metadata
Metadata
Assignees
Labels
No labels