Skip to content

Commit

Permalink
apply rustfmt in matches!
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Feb 13, 2021
1 parent 5388896 commit 76232da
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/message_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/irc/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/maybe_owned/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { .. })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/messages/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { .. }));
}
}
2 changes: 1 addition & 1 deletion src/messages/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { .. }))
}
}

Expand Down

0 comments on commit 76232da

Please sign in to comment.