Skip to content

Commit

Permalink
Fix reversed suggestion on postfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dswij committed Dec 25, 2021
1 parent 8ed723b commit c8f016f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion clippy_lints/src/enum_variants.rs
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/enum_variants.stderr
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit c8f016f

Please sign in to comment.