Skip to content

Commit

Permalink
made sure that variant missing has a witness
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Oct 18, 2024
1 parent 972a769 commit 6d2a737
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lints/enum_variant_missing.ron
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ SemverQuery(
},
error_message: "A publicly-visible enum has at least one variant that is no longer available under its prior name. It may have been renamed or removed entirely.",
per_result_error_template: Some("variant {{enum_name}}::{{variant_name}}, previously in file {{span_filename}}:{{span_begin_line}}"),
witness: (
hint_template: r#"let witness = {{join "::" path}}::{{variant_name}};"#,
),
)
14 changes: 14 additions & 0 deletions test_outputs/witnesses/enum_variant_missing.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
source: src/query.rs
description: "Lint `enum_variant_missing` did not have the expected witness output.\nSee https://github.com/obi1kenobi/cargo-semver-checks/blob/main/CONTRIBUTING.md#testing-witnesses\nfor more information."
expression: "&actual_witnesses"
---
[["./test_crates/enum_struct_variant_field_missing/"]]
filename = 'src/lib.rs'
begin_line = 14
hint = 'let witness = enum_struct_variant_field_missing::IgnoredEnum::StructVariantWillBeMissing;'

[["./test_crates/enum_variant_missing/"]]
filename = 'src/lib.rs'
begin_line = 5
hint = 'let witness = enum_variant_missing::VariantWillBeRemoved::Bar;'

0 comments on commit 6d2a737

Please sign in to comment.