rust-clippy/tests/ui/unnecessary_sort_by.stderr

77 lines
3.1 KiB
Text
Raw Normal View History

2020-05-25 03:05:58 +00:00
error: use Vec::sort here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:14:5
2020-05-25 02:45:41 +00:00
|
LL | vec.sort_by(|a, b| a.cmp(b));
2020-05-25 03:05:58 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort()`
2020-05-25 02:45:41 +00:00
|
2020-05-31 19:06:32 +00:00
= note: `-D clippy::unnecessary-sort-by` implied by `-D warnings`
2020-05-25 02:45:41 +00:00
2020-05-31 22:09:12 +00:00
error: use Vec::sort here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:15:5
2020-05-25 02:45:41 +00:00
|
2020-05-31 22:09:12 +00:00
LL | vec.sort_unstable_by(|a, b| a.cmp(b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable()`
error: use Vec::sort_by_key here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:16:5
2020-05-31 22:09:12 +00:00
|
2020-05-25 02:45:41 +00:00
LL | vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (a + 5).abs())`
2020-05-25 02:45:41 +00:00
error: use Vec::sort_by_key here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:17:5
2020-05-25 02:45:41 +00:00
|
2020-05-31 22:09:12 +00:00
LL | vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| id(-a))`
2020-05-25 02:45:41 +00:00
error: use Vec::sort_by_key here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:20:5
2020-05-25 02:45:41 +00:00
|
LL | vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|b| Reverse((b + 5).abs()))`
2020-05-25 02:45:41 +00:00
error: use Vec::sort_by_key here instead
2020-07-09 03:29:56 +00:00
--> $DIR/unnecessary_sort_by.rs:21:5
2020-05-25 02:45:41 +00:00
|
2020-05-31 22:09:12 +00:00
LL | vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|b| Reverse(id(-b)))`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:31:5
|
LL | vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (***a).abs())`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:32:5
|
LL | vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| (***a).abs())`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:88:9
|
LL | args.sort_by(|a, b| a.name().cmp(&b.name()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|a| a.name())`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:89:9
|
LL | args.sort_unstable_by(|a, b| a.name().cmp(&b.name()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|a| a.name())`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:91:9
|
LL | args.sort_by(|a, b| b.name().cmp(&a.name()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|b| Reverse(b.name()))`
error: use Vec::sort_by_key here instead
--> $DIR/unnecessary_sort_by.rs:92:9
|
LL | args.sort_unstable_by(|a, b| b.name().cmp(&a.name()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|b| Reverse(b.name()))`
2020-05-25 02:45:41 +00:00
error: aborting due to 12 previous errors
2020-05-25 02:45:41 +00:00