]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_sort_by.stderr
Renamed to
[rust.git] / tests / ui / unnecessary_sort_by.stderr
1 error: use Vec::sort here instead
2   --> $DIR/sort_by_key.rs:13:5
3    |
4 LL |     vec.sort_by(|a, b| a.cmp(b));
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort()`
6    |
7    = note: `-D clippy::sort-by-key` implied by `-D warnings`
8
9 error: use Vec::sort_by_key here instead
10   --> $DIR/sort_by_key.rs:14:5
11    |
12 LL |     vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs()));
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|&a| (a + 5).abs())`
14
15 error: use Vec::sort_by_key here instead
16   --> $DIR/sort_by_key.rs:15:5
17    |
18 LL |     vec.sort_by(|a, b| id(-a).cmp(&id(-b)));
19    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|&a| id(-a))`
20
21 error: use Vec::sort_by_key here instead
22   --> $DIR/sort_by_key.rs:17:5
23    |
24 LL |     vec.sort_by(|a, b| b.cmp(a));
25    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|&b| Reverse(b))`
26
27 error: use Vec::sort_by_key here instead
28   --> $DIR/sort_by_key.rs:18:5
29    |
30 LL |     vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs()));
31    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|&b| Reverse((b + 5).abs()))`
32
33 error: use Vec::sort_by_key here instead
34   --> $DIR/sort_by_key.rs:19:5
35    |
36 LL |     vec.sort_by(|a, b| id(-b).cmp(&id(-a)));
37    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|&b| Reverse(id(-b)))`
38
39 error: unknown clippy lint: clippy::sort_by_key_reverse
40   --> $DIR/sort_by_key.rs:2:9
41    |
42 LL | #![warn(clippy::sort_by_key_reverse)]
43    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::sort_by_key`
44    |
45    = note: `-D clippy::unknown-clippy-lints` implied by `-D warnings`
46
47 error: aborting due to 7 previous errors
48