Run cargo fmt

This commit is contained in:
Hyeon Kim 2023-06-04 01:16:14 +09:00
parent 781cbab4a4
commit a9b1ea3946
No known key found for this signature in database
GPG key ID: 0F85F46EE242057F
3 changed files with 16 additions and 12 deletions

View file

@ -399,11 +399,10 @@ impl Config {
/// Gets the nickname specified in the configuration. /// Gets the nickname specified in the configuration.
pub fn nickname(&self) -> Result<&str> { pub fn nickname(&self) -> Result<&str> {
self.nickname.as_deref() self.nickname.as_deref().ok_or_else(|| InvalidConfig {
.ok_or_else(|| InvalidConfig { path: self.path(),
path: self.path(), cause: ConfigError::NicknameNotSpecified,
cause: ConfigError::NicknameNotSpecified, })
})
} }
/// Gets the bot's nickserv password specified in the configuration. /// Gets the bot's nickserv password specified in the configuration.
@ -436,11 +435,10 @@ impl Config {
/// Gets the address of the server specified in the configuration. /// Gets the address of the server specified in the configuration.
pub fn server(&self) -> Result<&str> { pub fn server(&self) -> Result<&str> {
self.server.as_deref() self.server.as_deref().ok_or_else(|| InvalidConfig {
.ok_or_else(|| InvalidConfig { path: self.path(),
path: self.path(), cause: ConfigError::ServerNotSpecified,
cause: ConfigError::ServerNotSpecified, })
})
} }
/// Gets the port of the server specified in the configuration. /// Gets the port of the server specified in the configuration.

View file

@ -1305,7 +1305,6 @@ mod test {
.await?; .await?;
let res = client.stream()?.try_collect::<Vec<_>>().await; let res = client.stream()?.try_collect::<Vec<_>>().await;
if let Err(Error::NoUsableNick) = res { if let Err(Error::NoUsableNick) = res {
} else { } else {
panic!("expected error when no valid nicks were specified") panic!("expected error when no valid nicks were specified")
} }

View file

@ -118,7 +118,14 @@ impl Future for Pinger {
} }
} }
if self.as_mut().project().ping_interval.poll_tick(cx).is_ready() && *self.as_mut().project().enabled { if self
.as_mut()
.project()
.ping_interval
.poll_tick(cx)
.is_ready()
&& *self.as_mut().project().enabled
{
self.as_mut().send_ping()?; self.as_mut().send_ping()?;
} }