diff --git a/data/src/message/source.rs b/data/src/message/source.rs index 342996116..5da27144e 100644 --- a/data/src/message/source.rs +++ b/data/src/message/source.rs @@ -28,29 +28,24 @@ impl<'de> Deserialize<'de> for Server { D: Deserializer<'de>, { #[derive(Debug, Deserialize)] + #[serde(rename_all = "lowercase")] enum Mapping { - #[serde(rename = "join")] - JoinWithoutNick, - #[serde(rename = "joinwithnick")] - Join(Option), - #[serde(rename = "part")] - PartWithoutNick, - #[serde(rename = "partwithnick")] - Part(Option), - #[serde(rename = "quit")] - QuitWithoutNick, - #[serde(rename = "quitwithnick")] - Quit(Option), + Join, + JoinWithNick(Option), + Part, + PartWithNick(Option), + Quit, + QuitWithNick(Option), } if let Ok(mapping) = Mapping::deserialize(deserializer) { match mapping { - Mapping::JoinWithoutNick => Ok(Server::Join(None)), - Mapping::Join(nick) => Ok(Server::Join(nick)), - Mapping::PartWithoutNick => Ok(Server::Part(None)), - Mapping::Part(nick) => Ok(Server::Part(nick)), - Mapping::QuitWithoutNick => Ok(Server::Quit(None)), - Mapping::Quit(nick) => Ok(Server::Quit(nick)), + Mapping::Join => Ok(Server::Join(None)), + Mapping::JoinWithNick(nick) => Ok(Server::Join(nick)), + Mapping::Part => Ok(Server::Part(None)), + Mapping::PartWithNick(nick) => Ok(Server::Part(nick)), + Mapping::Quit => Ok(Server::Quit(None)), + Mapping::QuitWithNick(nick) => Ok(Server::Quit(nick)), } } else { Err(D::Error::custom("could not map to Server enum"))