From 8882c121f83cf4513eaee7515d6dcea133a65d69 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sat, 21 Feb 2026 13:32:00 +0100 Subject: replace all match_variant instances with try_into the match_variant macro was unclear, unreadable and no longer needed as we have automaticly derived from implementations for all Variant enum fields now --- src/message/signalproxy/objects/chanmodes.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/message/signalproxy/objects/chanmodes.rs') diff --git a/src/message/signalproxy/objects/chanmodes.rs b/src/message/signalproxy/objects/chanmodes.rs index 1161e28..b297126 100644 --- a/src/message/signalproxy/objects/chanmodes.rs +++ b/src/message/signalproxy/objects/chanmodes.rs @@ -62,20 +62,24 @@ impl NetworkMap for ChanModes { } fn from_network_map(input: &mut Self::Item) -> Self { + let channel_modes_a: VariantMap = input.remove("A").unwrap().try_into().unwrap(); + let channel_modes_b: VariantMap = input.remove("B").unwrap().try_into().unwrap(); + let channel_modes_c: VariantMap = input.remove("C").unwrap().try_into().unwrap(); + ChanModes { - channel_modes_a: match_variant!(input.remove("A").unwrap(), Variant::VariantMap) + channel_modes_a: channel_modes_a .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::StringList))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_b: match_variant!(input.remove("B").unwrap(), Variant::VariantMap) + channel_modes_b: channel_modes_b .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::String))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_c: match_variant!(input.remove("C").unwrap(), Variant::VariantMap) + channel_modes_c: channel_modes_c .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::String))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_d: match_variant!(input.remove("D").unwrap(), Variant::String), + channel_modes_d: input.remove("D").unwrap().try_into().unwrap(), } } } -- cgit v1.2.3