diff --git a/core/src/mercury/types.rs b/core/src/mercury/types.rs index 70fb3f862..8154d4f5f 100644 --- a/core/src/mercury/types.rs +++ b/core/src/mercury/types.rs @@ -57,7 +57,7 @@ impl std::fmt::Display for MercuryMethod { MercuryMethod::Unsub => "UNSUB", MercuryMethod::Send => "SEND", }; - write!(f, "{}", s) + write!(f, "{s}") } } diff --git a/core/src/proxytunnel.rs b/core/src/proxytunnel.rs index af51bbb73..9e8cd3b70 100644 --- a/core/src/proxytunnel.rs +++ b/core/src/proxytunnel.rs @@ -22,7 +22,7 @@ pub async fn proxy_connect( 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; @@ -31,7 +31,7 @@ pub async fn proxy_connect( 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 { @@ -39,12 +39,9 @@ pub async fn proxy_connect( 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")), }; } diff --git a/discovery/src/lib.rs b/discovery/src/lib.rs index c6d88a2e7..36fd2509c 100644 --- a/discovery/src/lib.rs +++ b/discovery/src/lib.rs @@ -96,12 +96,10 @@ pub fn find(name: Option<&str>) -> Result { 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 { @@ -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()); } } } diff --git a/oauth/src/lib.rs b/oauth/src/lib.rs index 284f08d7a..2706ac730 100644 --- a/oauth/src/lib.rs +++ b/oauth/src/lib.rs @@ -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 } @@ -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 :)")), diff --git a/playback/src/mixer/mappings.rs b/playback/src/mixer/mappings.rs index 736b3c3f7..bcb3fa455 100644 --- a/playback/src/mixer/mappings.rs +++ b/playback/src/mixer/mappings.rs @@ -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) } } diff --git a/src/main.rs b/src/main.rs index 1c4c4f2f8..85755658e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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