Skip to content

Chore: fix clippy warnings for stable (1.87) and nightly (1.89) #1504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/mercury/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl std::fmt::Display for MercuryMethod {
MercuryMethod::Unsub => "UNSUB",
MercuryMethod::Send => "SEND",
};
write!(f, "{}", s)
write!(f, "{s}")
}
}

Expand Down
11 changes: 4 additions & 7 deletions core/src/proxytunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn proxy_connect<T: AsyncRead + AsyncWrite + Unpin>(
loop {
let bytes_read = proxy_connection.read(&mut buffer[offset..]).await?;
if bytes_read == 0 {
return Err(io::Error::new(io::ErrorKind::Other, "Early EOF from proxy"));
return Err(io::Error::other("Early EOF from proxy"));
}
offset += bytes_read;

Expand All @@ -31,20 +31,17 @@ pub async fn proxy_connect<T: AsyncRead + AsyncWrite + Unpin>(

let status = response
.parse(&buffer[..offset])
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
.map_err(io::Error::other)?;

if status.is_complete() {
return match response.code {
Some(200) => Ok(proxy_connection), // Proxy says all is well
Some(code) => {
let reason = response.reason.unwrap_or("no reason");
let msg = format!("Proxy responded with {code}: {reason}");
Err(io::Error::new(io::ErrorKind::Other, msg))
Err(io::Error::other(msg))
}
None => Err(io::Error::new(
io::ErrorKind::Other,
"Malformed response from proxy",
)),
None => Err(io::Error::other("Malformed response from proxy")),
};
}

Expand Down
10 changes: 4 additions & 6 deletions discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ pub fn find(name: Option<&str>) -> Result<DnsSdServiceBuilder, Error> {
match BACKENDS.iter().find(|(id, _)| name == id) {
Some((_id, Some(launch_svc))) => Ok(*launch_svc),
Some((_id, None)) => Err(Error::unavailable(format!(
"librespot built without '{}' support",
name
"librespot built without '{name}' support"
))),
None => Err(Error::not_found(format!(
"unknown zeroconf backend '{}'",
name
"unknown zeroconf backend '{name}'"
))),
}
} else {
Expand Down Expand Up @@ -286,14 +284,14 @@ async fn avahi_task(
//
// EntryGroup has been withdrawn at this point already!
log::error!("zeroconf collision for name '{}'", &name);
return Err(zbus::Error::Failure(format!("zeroconf collision for name: {}", name)).into());
return Err(zbus::Error::Failure(format!("zeroconf collision for name: {name}")).into());
}
EntryGroupState::Failure => {
// TODO: Back off/treat as fatal?
// EntryGroup has been withdrawn at this point already!
// There seems to be no code in Avahi that actually sets this state.
log::error!("zeroconf failure: {}", error);
return Err(zbus::Error::Failure(format!("zeroconf failure: {}", error)).into());
return Err(zbus::Error::Failure(format!("zeroconf failure: {error}")).into());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions oauth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl OAuthClient {
if self.should_open_url {
open::that_in_background(auth_url.as_str());
}
println!("Browse to: {}", auth_url);
println!("Browse to: {auth_url}");

pkce_verifier
}
Expand Down Expand Up @@ -456,7 +456,7 @@ pub fn get_access_token(
.set_pkce_challenge(pkce_challenge)
.url();

println!("Browse to: {}", auth_url);
println!("Browse to: {auth_url}");

let code = match get_socket_address(redirect_uri) {
Some(addr) => get_authcode_listener(addr, String::from("Go back to your terminal :)")),
Expand Down
2 changes: 1 addition & 1 deletion playback/src/mixer/mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ impl CubicMapping {
fn min_norm(db_range: f64) -> f64 {
// Note that this 60.0 is unrelated to DEFAULT_DB_RANGE.
// Instead, it's the cubic voltage to dB ratio.
f64::powf(10.0, -1.0 * db_range / 60.0)
f64::powf(10.0, -db_range / 60.0)
}
}
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,7 @@ fn get_setup() -> Setup {
Some("librespot compiled without zeroconf backend".to_owned())
} else if opt_present(DISABLE_DISCOVERY) {
Some(format!(
"the `--{}` / `-{}` flag set",
DISABLE_DISCOVERY, DISABLE_DISCOVERY_SHORT,
"the `--{DISABLE_DISCOVERY}` / `-{DISABLE_DISCOVERY_SHORT}` flag set",
))
} else {
None
Expand Down
Loading