diff options
| author | dswij <dswijj@gmail.com> | 2021-12-23 13:55:41 +0800 |
|---|---|---|
| committer | Dharma Saputra Wijaya <dswijj@gmail.com> | 2021-12-25 21:55:20 +0800 |
| commit | c8f016f921d8ade5bf97315d722bf24badca8519 (patch) | |
| tree | 9f974b73d45ea010d3013bff0bfd12b39a50a328 | |
| parent | 8ed723bb1f988d0fb624817bcb7e10da192bcbd9 (diff) | |
| download | rust-c8f016f921d8ade5bf97315d722bf24badca8519.tar.gz rust-c8f016f921d8ade5bf97315d722bf24badca8519.zip | |
Fix reversed suggestion on postfix
| -rw-r--r-- | clippy_lints/src/enum_variants.rs | 5 | ||||
| -rw-r--r-- | tests/ui/enum_variants.stderr | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index 9862a8c4f52..fd359b4e36f 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -185,7 +185,10 @@ fn check_variant(cx: &LateContext<'_>, threshold: u64, def: &EnumDef<'_>, item_n let (what, value) = match (pre.is_empty(), post.is_empty()) { (true, true) => return, (false, _) => ("pre", pre.join("")), - (true, false) => ("post", post.join("")), + (true, false) => { + post.reverse(); + ("post", post.join("")) + }, }; span_lint_and_help( cx, diff --git a/tests/ui/enum_variants.stderr b/tests/ui/enum_variants.stderr index 82a2b3dccb0..8a3265086e8 100644 --- a/tests/ui/enum_variants.stderr +++ b/tests/ui/enum_variants.stderr @@ -96,7 +96,7 @@ LL | | } | = help: remove the prefixes and use full paths to the variants instead of glob imports -error: all variants have the same postfix: `DataI` +error: all variants have the same postfix: `IData` --> $DIR/enum_variants.rs:136:1 | LL | / enum IDataRequest { @@ -108,7 +108,7 @@ LL | | } | = help: remove the postfixes and use full paths to the variants instead of glob imports -error: all variants have the same postfix: `DataIH` +error: all variants have the same postfix: `HIData` --> $DIR/enum_variants.rs:142:1 | LL | / enum HIDataRequest { |
