fix(tests): allow "dead-code" in derive tests

This commit is contained in:
Brooks J Rady 2024-03-26 18:58:43 -07:00
parent 211f022501
commit bb5acb1367
1 changed files with 6 additions and 0 deletions

View File

@ -6,12 +6,14 @@ fn related() {
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]
#[error("welp")] #[error("welp")]
#[diagnostic(code(foo::bar::baz))] #[diagnostic(code(foo::bar::baz))]
#[allow(dead_code)]
struct Foo { struct Foo {
#[related] #[related]
related: Vec<Baz>, related: Vec<Baz>,
} }
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]
#[allow(dead_code)]
enum Bar { enum Bar {
#[error("variant1")] #[error("variant1")]
#[diagnostic(code(foo::bar::baz))] #[diagnostic(code(foo::bar::baz))]
@ -29,6 +31,7 @@ fn related() {
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]
#[error("welp2")] #[error("welp2")]
#[allow(dead_code)]
struct Baz; struct Baz;
} }
@ -37,6 +40,7 @@ fn related_report() {
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]
#[error("welp")] #[error("welp")]
#[diagnostic(code(foo::bar::baz))] #[diagnostic(code(foo::bar::baz))]
#[allow(dead_code)]
struct Foo { struct Foo {
#[related] #[related]
related: Vec<Report>, related: Vec<Report>,
@ -288,6 +292,7 @@ fn test_snippet_named_struct() {
#[derive(Debug, Diagnostic, Error)] #[derive(Debug, Diagnostic, Error)]
#[error("welp")] #[error("welp")]
#[diagnostic(code(foo::bar::baz))] #[diagnostic(code(foo::bar::baz))]
#[allow(dead_code)]
struct Foo<'a> { struct Foo<'a> {
#[source_code] #[source_code]
src: &'a str, src: &'a str,
@ -310,6 +315,7 @@ fn test_snippet_unnamed_struct() {
#[derive(Debug, Diagnostic, Error)] #[derive(Debug, Diagnostic, Error)]
#[error("welp")] #[error("welp")]
#[diagnostic(code(foo::bar::baz))] #[diagnostic(code(foo::bar::baz))]
#[allow(dead_code)]
struct Foo<'a>( struct Foo<'a>(
#[source_code] &'a str, #[source_code] &'a str,
#[label("{0}")] SourceSpan, #[label("{0}")] SourceSpan,