From a3ef0ad2a4ce8dc6eab10ff135db389b93a33683 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 6 Oct 2021 22:03:27 +0200 Subject: [PATCH] events-macros: Use nested or-patterns in EventKind::to_event_ident MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … for better readability. --- crates/ruma-events-macros/src/event_parse.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/crates/ruma-events-macros/src/event_parse.rs b/crates/ruma-events-macros/src/event_parse.rs index 23aeab6d..c78787db 100644 --- a/crates/ruma-events-macros/src/event_parse.rs +++ b/crates/ruma-events-macros/src/event_parse.rs @@ -127,17 +127,9 @@ impl EventKind { // this match is only used to validate the input match (self, var) { (_, V::Full) - | (Self::Ephemeral, V::Sync) - | (Self::Message, V::Sync) - | (Self::State, V::Sync) - | (Self::State, V::Stripped) - | (Self::State, V::Initial) - | (Self::Message, V::Redacted) - | (Self::RoomRedaction, V::Redacted) - | (Self::State, V::Redacted) - | (Self::Message, V::RedactedSync) - | (Self::RoomRedaction, V::RedactedSync) - | (Self::State, V::RedactedSync) => Some(format_ident!("{}{}", var, self)), + | (Self::Message | Self::RoomRedaction | Self::State | Self::Ephemeral, V::Sync) + | (Self::Message | Self::RoomRedaction | Self::State, V::Redacted | V::RedactedSync) + | (Self::State, V::Stripped | V::Initial) => Some(format_ident!("{}{}", var, self)), _ => None, } }