Hi, I am not sure what to search for but I didn't find anything.
I want to check if an enum field equals some parameter
if !matches!(&args[0].0, &vc.script_context.return_type)
but it complains about the first . after vc
error: no rules expected the token `.`
| if !matches!(&args[0].0, &vc.script_context.return_type)
| ^ no rules expected this token in macro call
|
= note: while trying to match sequence start
I don't understand why it cannot parse this, it should in my opinion.
So my workaround is to reference vc.script_context.return_type into a variable:
let value_type = &vc.script_context.return_type;
if !matches!(&args[0].0, value_type)
which compiles fine. But it gives me this non-sensical warning:
warning: unused variable: `value_type`
711 | let value_type = &vc.script_context.return_type;
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_value_type`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `value_type`
|
712 | if !matches!(&args[0].0, value_type)
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_value_type`
it claims that the variable that I am using here is unused, which is just wrong.
Am I missing something? Or is this a bug?
Thanks in advance