How do I assert an enum is a specific variant if I don't care about its fields?
How do I assert an enum is a specific variant if I don't care about its fields? I'd like to check enums with fields in tests while ignoring the actual value of the fields for now. Consider the following example: enum MyEnum { WithoutFields, WithFields { field: String }, } fn return_with_fields() -> MyEnum { MyEnum::WithFields { field: "some string".into(), } } #[cfg(test)] mod tests { use super::*; #[test] fn example() { assert_eq!(return_with_fields(), MyEnum::WithFields {..}); } } playground I'd like to use assert_eq! here, but the compiler tells me: assert_eq! error: expected expression, found `}` --> src/lib.rs:18:64 | 18 | assert_eq!(return_with_fields(), MyEnum::WithFields {..}); | ^ expected expression This is similar to Why do I get an error when pattern matching a struct-like enum variant with fields?, but the solution does...