diff --git a/impl/src/fmt.rs b/impl/src/fmt.rs index 3d1394c..d2ab353 100644 --- a/impl/src/fmt.rs +++ b/impl/src/fmt.rs @@ -193,6 +193,8 @@ fn fallback_explicit_named_args(input: ParseStream) -> Result { let ident = input.call(Ident::parse_any)?; input.parse::()?; args.named.insert(ident); + } else { + input.parse::()?; } } diff --git a/tests/ui/expression-fallback.rs b/tests/ui/expression-fallback.rs new file mode 100644 index 0000000..7269129 --- /dev/null +++ b/tests/ui/expression-fallback.rs @@ -0,0 +1,7 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error("".yellow)] +pub struct ArgError; + +fn main() {} diff --git a/tests/ui/expression-fallback.stderr b/tests/ui/expression-fallback.stderr new file mode 100644 index 0000000..5c9f215 --- /dev/null +++ b/tests/ui/expression-fallback.stderr @@ -0,0 +1,19 @@ +error: expected `,`, found `.` + --> tests/ui/expression-fallback.rs:4:11 + | +4 | #[error("".yellow)] + | ^ expected `,` + +error: argument never used + --> tests/ui/expression-fallback.rs:4:12 + | +4 | #[error("".yellow)] + | -- ^^^^^^ argument never used + | | + | formatting specifier missing + +error[E0425]: cannot find value `yellow` in this scope + --> tests/ui/expression-fallback.rs:4:12 + | +4 | #[error("".yellow)] + | ^^^^^^ not found in this scope