Less authoritative stable_sort_primitive message

This commit is contained in:
bing 2022-04-18 14:42:24 +08:00
parent e5ebece910
commit 7a4d07105f
2 changed files with 9 additions and 9 deletions

View file

@ -30,7 +30,7 @@ declare_clippy_lint! {
/// ``` /// ```
#[clippy::version = "1.47.0"] #[clippy::version = "1.47.0"]
pub STABLE_SORT_PRIMITIVE, pub STABLE_SORT_PRIMITIVE,
perf, pedantic,
"use of sort() when sort_unstable() is equivalent" "use of sort() when sort_unstable() is equivalent"
} }
@ -126,7 +126,7 @@ impl LateLintPass<'_> for StableSortPrimitive {
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
diag.note( diag.note(
"an unstable sort would perform faster without any observable difference for this data type", "an unstable sort typically performs faster without any observable difference for this data type",
); );
}, },
); );

View file

@ -5,7 +5,7 @@ LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: `-D clippy::stable-sort-primitive` implied by `-D warnings` = note: `-D clippy::stable-sort-primitive` implied by `-D warnings`
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `bool` error: used `sort` on primitive type `bool`
--> $DIR/stable_sort_primitive.rs:9:5 --> $DIR/stable_sort_primitive.rs:9:5
@ -13,7 +13,7 @@ error: used `sort` on primitive type `bool`
LL | vec.sort(); LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `char` error: used `sort` on primitive type `char`
--> $DIR/stable_sort_primitive.rs:11:5 --> $DIR/stable_sort_primitive.rs:11:5
@ -21,7 +21,7 @@ error: used `sort` on primitive type `char`
LL | vec.sort(); LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `str` error: used `sort` on primitive type `str`
--> $DIR/stable_sort_primitive.rs:13:5 --> $DIR/stable_sort_primitive.rs:13:5
@ -29,7 +29,7 @@ error: used `sort` on primitive type `str`
LL | vec.sort(); LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `tuple` error: used `sort` on primitive type `tuple`
--> $DIR/stable_sort_primitive.rs:15:5 --> $DIR/stable_sort_primitive.rs:15:5
@ -37,7 +37,7 @@ error: used `sort` on primitive type `tuple`
LL | vec.sort(); LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `array` error: used `sort` on primitive type `array`
--> $DIR/stable_sort_primitive.rs:17:5 --> $DIR/stable_sort_primitive.rs:17:5
@ -45,7 +45,7 @@ error: used `sort` on primitive type `array`
LL | vec.sort(); LL | vec.sort();
| ^^^^^^^^^^ help: try: `vec.sort_unstable()` | ^^^^^^^^^^ help: try: `vec.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: used `sort` on primitive type `i32` error: used `sort` on primitive type `i32`
--> $DIR/stable_sort_primitive.rs:19:5 --> $DIR/stable_sort_primitive.rs:19:5
@ -53,7 +53,7 @@ error: used `sort` on primitive type `i32`
LL | arr.sort(); LL | arr.sort();
| ^^^^^^^^^^ help: try: `arr.sort_unstable()` | ^^^^^^^^^^ help: try: `arr.sort_unstable()`
| |
= note: an unstable sort would perform faster without any observable difference for this data type = note: an unstable sort typically performs faster without any observable difference for this data type
error: aborting due to 7 previous errors error: aborting due to 7 previous errors