Merge pull request #104 from michel/michel/chore/clippy-redundant-else

chore: satisfy clippy 1.99
This commit is contained in:
Michel de Graaf
2026-10-26 17:17:22 +01:00
committed by GitHub
2 changed files with 27 additions and 24 deletions
+3
View File
@@ -53,6 +53,9 @@ significant_drop_tightening = "allow"
# Subjective nursery lint: the suggested map_or/map_or_else rewrites read worse # Subjective nursery lint: the suggested map_or/map_or_else rewrites read worse
# than the explicit if let/match they replace. # than the explicit if let/match they replace.
option_if_let_else = "allow" option_if_let_else = "allow"
# `assert!(x.is_empty())` in tests is fine; the suggested
# `assert_eq!(x, [] as [T; 0])` only trades a clear check for a type-cast chore.
assert_is_empty = "allow"
# The MD5 round functions use the conventional a/b/c/d register names from the # The MD5 round functions use the conventional a/b/c/d register names from the
# RFC 1321 reference implementation. # RFC 1321 reference implementation.
many_single_char_names = "allow" many_single_char_names = "allow"
+8 -8
View File
@@ -209,9 +209,12 @@ impl Client {
/// control. /// control.
pub fn login(&self) -> Result<bool> { pub fn login(&self) -> Result<bool> {
info!("Logging in as {}", self.username); info!("Logging in as {}", self.username);
if let Some(handle) = &self.server_handle let Some(handle) = &self.server_handle else {
&& !self.cancel.is_cancelled() return Err(SoulseekRs::NotConnected);
{ };
if self.cancel.is_cancelled() {
return Err(SoulseekRs::NotConnected);
}
let (tx, rx) = std::sync::mpsc::channel(); let (tx, rx) = std::sync::mpsc::channel();
let _ = handle.send(ServerMessage::Login { let _ = handle.send(ServerMessage::Login {
username: self.username.clone(), username: self.username.clone(),
@@ -229,14 +232,11 @@ impl Client {
{ {
return Err(SoulseekRs::NotConnected); return Err(SoulseekRs::NotConnected);
} }
Err(RecvTimeoutError::Timeout) Err(RecvTimeoutError::Timeout) if Instant::now() < deadline => {
if Instant::now() < deadline => {} }
Err(_) => return Err(SoulseekRs::Timeout), Err(_) => return Err(SoulseekRs::Timeout),
} }
} }
} else {
Err(SoulseekRs::NotConnected)
}
} }
/// Ask the server for a peer's address and open a direct control /// Ask the server for a peer's address and open a direct control