From 9af0988e5212aac8967951a6a4313e32968fb96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Sun, 16 Nov 2025 09:08:10 -0500 Subject: [PATCH] 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 --- tests/derive.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/derive.rs b/tests/derive.rs index 3cc0e8b..087d184 100644 --- a/tests/derive.rs +++ b/tests/derive.rs @@ -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, @@ -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 {