Avatar ·

How to compare two enum values in Rust without using match?

Hello! I started learning Rust and encountered a problem when working with enums. I have an enum representing an order status: ```rust #[derive(Debug)] enum OrderStatus { Pending, Processing, Shipped, Delivered, Cancelled, } ``` I need to simply check if the current status equals a specific variant, for example, `Pending`. In other languages (C++, Java) I could write `if (status == OrderStatus::Pending)`, but in Rust this doesn't work: ```rust let status = OrderStatus::Pending; if status == OrderStatus::Pending { println!("Order is pending processing"); } ``` The compiler gives an error: `binary operation `==` cannot be applied to type `OrderStatus``. I understand that I can use `match`, but for such a simple check it seems too