aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mumlib/src')
-rw-r--r--mumlib/src/error.rs4
-rw-r--r--mumlib/src/state.rs25
2 files changed, 20 insertions, 9 deletions
diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs
index c9eff52..5b82fbd 100644
--- a/mumlib/src/error.rs
+++ b/mumlib/src/error.rs
@@ -20,7 +20,9 @@ impl Display for Error {
Error::DisconnectedError => write!(f, "Not connected to a server"),
Error::AlreadyConnectedError => write!(f, "Already connected to a server"),
Error::ChannelIdentifierError(id, kind) => write!(f, "{}: {}", kind, id),
- Error::InvalidServerAddrError(addr, port) => write!(f, "Invalid server address: {}: {}", addr, port),
+ Error::InvalidServerAddrError(addr, port) => {
+ write!(f, "Invalid server address: {}: {}", addr, port)
+ }
Error::InvalidUserIdentifierError(name) => write!(f, "Invalid username: {}", name),
Error::InvalidUsernameError(username) => write!(f, "Invalid username: {}", username),
}
diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs
index 0540f14..3b1da56 100644
--- a/mumlib/src/state.rs
+++ b/mumlib/src/state.rs
@@ -131,18 +131,27 @@ pub struct User {
}
macro_rules! true_to_str {
- ($condition:expr, $res:expr) => {if $condition { $res } else { "" }};
+ ($condition:expr, $res:expr) => {
+ if $condition {
+ $res
+ } else {
+ ""
+ }
+ };
}
impl Display for User {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- write!(f, "{} {}{}{}{}{}",
- self.name,
- true_to_str!(self.suppress, "s"),
- true_to_str!(self.self_mute, "M"),
- true_to_str!(self.self_deaf, "D"),
- true_to_str!(self.mute, "m"),
- true_to_str!(self.deaf, "d"))
+ write!(
+ f,
+ "{} {}{}{}{}{}",
+ self.name,
+ true_to_str!(self.suppress, "s"),
+ true_to_str!(self.self_mute, "M"),
+ true_to_str!(self.self_deaf, "D"),
+ true_to_str!(self.mute, "m"),
+ true_to_str!(self.deaf, "d")
+ )
}
}