When you define an enum, add derive:#[derive(PartialEq, Eq)] enum Foo {…} to make it work with ==, e.g.if foo_value == Foo::Variant { … } Otherwise comparison will only work with pattern matching (match, if let, matches!(), etc.)⏴ ⏵