Probably I've complained about this before. But—

I'm in Rust. I am matching an enum. I want to collapse variants A(x), B(x), and C(x) into one match, but I want afterward to have a boolean indicating whether I am in case C.

Is there a lesss… ridiculous… way of doing this… than the thing I do here

match (line, true, false) {
    (ScrollChatLine::Chat(chat), _, m@false) |
    (ScrollChatLine::Pending(chat), _, m@false) |
    (ScrollChatLine::ModeratedHide(chat, false), m@true, _) => {
        let class = if m { "chat-hidden" } else { "chat" };
        html!{
            <div class={class}>
                {chat.user_name.to_owned()}{": "}{chat.text.to_owned()}
            </div>
        }
    },
    (ScrollChatLine::Moderated | ScrollChatLine::ModeratedHide(_, true), _, _) => {
        html!{
            <div class="chat-removed">
                {"Comment removed."}
            </div>
        }
    },
    (_,_,_) => panic!("unreachable") // THIS SHOULDN'T BE REQUIRED??
}
0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/mcc/statuses/116111170113270374 on your instance and quote it. (Note that quoting is not supported in Mastodon.)