2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:12:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_by(|a, b| a.cmp(b));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::unnecessary-sort-by` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_sort_by)]`
|
2020-06-09 14:36:01 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:13:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_unstable_by(|a, b| a.cmp(b));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:14:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs()));
|
2020-10-09 10:45:29 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (a + 5).abs())`
|
2020-06-09 14:36:01 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:15:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b)));
|
2020-10-09 10:45:29 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| id(-a))`
|
2020-06-09 14:36:01 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:18:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs()));
|
2022-03-14 11:02:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs()))`
|
2020-06-09 14:36:01 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:19:5
|
2020-06-09 14:36:01 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a)));
|
2022-03-14 11:02:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|b| std::cmp::Reverse(id(-b)))`
|
2020-10-09 10:45:29 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:29:5
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (***a).abs())`
|
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:30:5
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_unstable_by_key(|a| (***a).abs())`
|
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:89:9
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | args.sort_by(|a, b| a.name().cmp(&b.name()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|a| a.name())`
|
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:90:9
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | args.sort_unstable_by(|a, b| a.name().cmp(&b.name()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|a| a.name())`
|
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:92:9
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | args.sort_by(|a, b| b.name().cmp(&a.name()));
|
2022-03-14 11:02:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|b| std::cmp::Reverse(b.name()))`
|
2020-10-09 10:45:29 +00:00
|
|
|
|
2024-01-25 18:17:36 +00:00
|
|
|
error: consider using `sort_by_key`
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/unnecessary_sort_by.rs:93:9
|
2020-10-09 10:45:29 +00:00
|
|
|
|
|
|
|
|
LL | args.sort_unstable_by(|a, b| b.name().cmp(&a.name()));
|
2022-03-14 11:02:53 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_unstable_by_key(|b| std::cmp::Reverse(b.name()))`
|
2020-06-09 14:36:01 +00:00
|
|
|
|
2020-10-09 10:45:29 +00:00
|
|
|
error: aborting due to 12 previous errors
|
2020-06-09 14:36:01 +00:00
|
|
|
|