]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_sort_by.stderr
Auto merge of #99099 - Stargateur:phantomdata_debug, r=joshtriplett
[rust.git] / src / tools / clippy / tests / ui / unnecessary_sort_by.stderr
1 error: use Vec::sort here instead
2   --> $DIR/unnecessary_sort_by.rs:14:5
3    |
4 LL |     vec.sort_by(|a, b| a.cmp(b));
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort()`
6    |
7    = note: `-D clippy::unnecessary-sort-by` implied by `-D warnings`
8
9 error: use Vec::sort here instead
10   --> $DIR/unnecessary_sort_by.rs:15:5
11    |
12 LL |     vec.sort_unstable_by(|a, b| a.cmp(b));
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable()`
14
15 error: use Vec::sort_by_key here instead
16   --> $DIR/unnecessary_sort_by.rs:16:5
17    |
18 LL |     vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs()));
19    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (a + 5).abs())`
20
21 error: use Vec::sort_by_key here instead
22   --> $DIR/unnecessary_sort_by.rs:17:5
23    |
24 LL |     vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b)));
25    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| id(-a))`
26
27 error: use Vec::sort_by_key here instead
28   --> $DIR/unnecessary_sort_by.rs:20:5
29    |
30 LL |     vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs()));
31    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs()))`
32
33 error: use Vec::sort_by_key here instead
34   --> $DIR/unnecessary_sort_by.rs:21:5
35    |
36 LL |     vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a)));
37    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|b| std::cmp::Reverse(id(-b)))`
38
39 error: use Vec::sort_by_key here instead
40   --> $DIR/unnecessary_sort_by.rs:31:5
41    |
42 LL |     vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs()));
43    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (***a).abs())`
44
45 error: use Vec::sort_by_key here instead
46   --> $DIR/unnecessary_sort_by.rs:32:5
47    |
48 LL |     vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs()));
49    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| (***a).abs())`
50
51 error: use Vec::sort_by_key here instead
52   --> $DIR/unnecessary_sort_by.rs:91:9
53    |
54 LL |         args.sort_by(|a, b| a.name().cmp(&b.name()));
55    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|a| a.name())`
56
57 error: use Vec::sort_by_key here instead
58   --> $DIR/unnecessary_sort_by.rs:92:9
59    |
60 LL |         args.sort_unstable_by(|a, b| a.name().cmp(&b.name()));
61    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|a| a.name())`
62
63 error: use Vec::sort_by_key here instead
64   --> $DIR/unnecessary_sort_by.rs:94:9
65    |
66 LL |         args.sort_by(|a, b| b.name().cmp(&a.name()));
67    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|b| std::cmp::Reverse(b.name()))`
68
69 error: use Vec::sort_by_key here instead
70   --> $DIR/unnecessary_sort_by.rs:95:9
71    |
72 LL |         args.sort_unstable_by(|a, b| b.name().cmp(&a.name()));
73    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|b| std::cmp::Reverse(b.name()))`
74
75 error: aborting due to 12 previous errors
76