From 76232dac4155a2ae971cf015ad07cfaa5816d5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 13 Feb 2021 20:35:55 +0100 Subject: [PATCH] apply rustfmt in matches! --- examples/message_parse.rs | 4 ++-- src/irc/prefix.rs | 4 ++-- src/maybe_owned/mod.rs | 2 +- src/messages/commands.rs | 2 +- src/messages/join.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/message_parse.rs b/examples/message_parse.rs index 2c6917c..edf5318 100644 --- a/examples/message_parse.rs +++ b/examples/message_parse.rs @@ -44,7 +44,7 @@ fn parse_demo() { // parse it as an Commands, which wraps all of the provided messages let all = messages::Commands::from_irc(msg).unwrap(); - assert!(matches!(all, messages::Commands::Privmsg{..})); + assert!(matches!(all, messages::Commands::Privmsg { .. })); // this is still borrowing from the 'input' from above. let all: messages::Commands<'_> = all; @@ -82,7 +82,7 @@ fn parse_demo() { // you can convert a parsed message into an Commands easily by using From/Into; let all: messages::Commands<'_> = msg_b.into(); - assert!(matches!(all, messages::Commands::Raw{..})); + assert!(matches!(all, messages::Commands::Raw { .. })); } fn decoder_demo() { diff --git a/src/irc/prefix.rs b/src/irc/prefix.rs index 6a722b9..b6ce4f8 100644 --- a/src/irc/prefix.rs +++ b/src/irc/prefix.rs @@ -20,7 +20,7 @@ impl<'a> Prefix<'a> { /// Was this message from a user? pub fn is_user(&self) -> bool { - matches!(self.index, PrefixIndex::User{ .. }) + matches!(self.index, PrefixIndex::User { .. }) } /// Get the full, raw string @@ -57,7 +57,7 @@ impl PrefixIndex { /// Was this message from a user? pub fn is_nick(&self) -> bool { - matches!(self, Self::User{ .. }) + matches!(self, Self::User { .. }) } /// Get the index of the nickname diff --git a/src/maybe_owned/mod.rs b/src/maybe_owned/mod.rs index 8c4f0ec..a2674a4 100644 --- a/src/maybe_owned/mod.rs +++ b/src/maybe_owned/mod.rs @@ -34,7 +34,7 @@ impl<'a> MaybeOwned<'a> { /// Checks whether this type is in the `Borrowed` state pub fn is_borrowed(&self) -> bool { - matches!(self, Self::Borrowed{..}) + matches!(self, Self::Borrowed { .. }) } } diff --git a/src/messages/commands.rs b/src/messages/commands.rs index 0c93460..236f4ee 100644 --- a/src/messages/commands.rs +++ b/src/messages/commands.rs @@ -215,6 +215,6 @@ mod tests { let input = ":test!test@test PRIVMSG #museun :this is a test\r\n"; let msg = IrcMessage::parse(MaybeOwned::Borrowed(input)).unwrap(); let all = Commands::from_irc(msg).unwrap(); - assert!(matches!(all, Commands::Privmsg{..})); + assert!(matches!(all, Commands::Privmsg { .. })); } } diff --git a/src/messages/join.rs b/src/messages/join.rs index a1b91f2..b4a4749 100644 --- a/src/messages/join.rs +++ b/src/messages/join.rs @@ -61,7 +61,7 @@ mod tests { let input = ":tmi.twitch.tv NOT_JOIN #foo\r\n"; for msg in parse(input).map(|s| s.unwrap()) { let err = Join::from_irc(msg).unwrap_err(); - assert!(matches!(err,MessageError::InvalidCommand { .. })) + assert!(matches!(err, MessageError::InvalidCommand { .. })) } }