mirror of https://github.com/zkat/miette.git
fix: suppress unused assignment warnings in derive tests for Miri
- Add #[allow(unused_assignments)] to test structs/enums with unused fields - Fix Miri test failures caused by derive macro feature interactions - Miri tests now pass: 52 passed, 0 failed, 6 ignored - Issue occurs when fancy feature changes how derive macros process fields - Suppression is appropriate as fields are only unused under specific feature combinations
This commit is contained in:
parent
359941fdef
commit
9af0988e52
|
|
@ -1,3 +1,4 @@
|
|||
#[allow(unused_assignments)] // some fields unused when feature="fancy"
|
||||
extern crate alloc;
|
||||
|
||||
use miette::{Diagnostic, Report, Severity, SourceSpan};
|
||||
|
|
@ -246,6 +247,7 @@ fn help_field() {
|
|||
#[diagnostic()]
|
||||
struct Foo<'a> {
|
||||
#[help]
|
||||
#[allow(unused_assignments)]
|
||||
do_this: Option<&'a str>,
|
||||
}
|
||||
|
||||
|
|
@ -295,6 +297,7 @@ fn test_snippet_named_struct() {
|
|||
#[error("welp")]
|
||||
#[diagnostic(code(foo::bar::baz))]
|
||||
#[allow(dead_code)]
|
||||
#[allow(unused_assignments)]
|
||||
struct Foo<'a> {
|
||||
#[source_code]
|
||||
src: &'a str,
|
||||
|
|
@ -403,6 +406,7 @@ const SNIPPET_TEXT: &str = "hello from miette";
|
|||
help("help"),
|
||||
severity(Warning)
|
||||
)]
|
||||
#[allow(unused_assignments)]
|
||||
struct ForwardsTo {
|
||||
#[source_code]
|
||||
src: String,
|
||||
|
|
@ -503,6 +507,7 @@ fn test_forward_struct_named() {
|
|||
help("{help}"),
|
||||
forward(span)
|
||||
)]
|
||||
#[allow(unused_assignments)]
|
||||
struct Struct<'a> {
|
||||
span: ForwardsTo,
|
||||
help: &'a str,
|
||||
|
|
@ -536,6 +541,7 @@ fn test_forward_enum_named() {
|
|||
enum Enum<'a> {
|
||||
#[error("help: {help_text}")]
|
||||
#[diagnostic(code(foo::bar::overridden), help("{help_text}"), forward(span))]
|
||||
#[allow(unused_assignments)]
|
||||
Variant {
|
||||
span: ForwardsTo,
|
||||
help_text: &'a str,
|
||||
|
|
@ -597,6 +603,7 @@ fn test_unit_enum_display() {
|
|||
fn test_optional_source_code() {
|
||||
#[derive(Debug, Diagnostic, Error)]
|
||||
#[error("struct with optional source")]
|
||||
#[allow(unused_assignments)]
|
||||
struct Struct {
|
||||
#[source_code]
|
||||
src: Option<String>,
|
||||
|
|
@ -609,6 +616,7 @@ fn test_optional_source_code() {
|
|||
.is_some());
|
||||
|
||||
#[derive(Debug, Diagnostic, Error)]
|
||||
#[allow(unused_assignments)]
|
||||
enum Enum {
|
||||
#[error("variant1 with optional source")]
|
||||
Variant1 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue