diff --git a/core/src/spclient.rs b/core/src/spclient.rs index 37a125ad..820b2182 100644 --- a/core/src/spclient.rs +++ b/core/src/spclient.rs @@ -257,7 +257,7 @@ impl SpClient { let mut tries: usize = 0; let mut last_response; - let body = body.unwrap_or_else(String::new); + let body = body.unwrap_or_default(); loop { tries += 1; diff --git a/discovery/src/lib.rs b/discovery/src/lib.rs index b4e95737..02686e3e 100644 --- a/discovery/src/lib.rs +++ b/discovery/src/lib.rs @@ -16,7 +16,6 @@ use std::{ task::{Context, Poll}, }; -use cfg_if::cfg_if; use futures_core::Stream; use thiserror::Error; @@ -117,29 +116,23 @@ impl Builder { let name = self.server_config.name.clone().into_owned(); let server = DiscoveryServer::new(self.server_config, &mut port)??; - let svc; + #[cfg(feature = "with-dns-sd")] + let svc = dns_sd::DNSService::register( + Some(name.as_ref()), + "_spotify-connect._tcp", + None, + None, + port, + &["VERSION=1.0", "CPath=/"], + )?; - cfg_if! { - if #[cfg(feature = "with-dns-sd")] { - svc = dns_sd::DNSService::register( - Some(name.as_ref()), - "_spotify-connect._tcp", - None, - None, - port, - &["VERSION=1.0", "CPath=/"], - )?; - - } else { - let responder = libmdns::Responder::spawn(&tokio::runtime::Handle::current())?; - svc = responder.register( - "_spotify-connect._tcp".to_owned(), - name, - port, - &["VERSION=1.0", "CPath=/"], - ) - } - }; + #[cfg(not(feature = "with-dns-sd"))] + let svc = libmdns::Responder::spawn(&tokio::runtime::Handle::current())?.register( + "_spotify-connect._tcp".to_owned(), + name, + port, + &["VERSION=1.0", "CPath=/"], + ); Ok(Discovery { server, _svc: svc }) } diff --git a/playback/src/audio_backend/alsa.rs b/playback/src/audio_backend/alsa.rs index 16aa420d..c639228c 100644 --- a/playback/src/audio_backend/alsa.rs +++ b/playback/src/audio_backend/alsa.rs @@ -144,7 +144,7 @@ fn list_compatible_devices() -> SinkResult<()> { println!( "\tDescription:\n\n\t\t{}\n", - a.desc.unwrap_or_default().replace("\n", "\n\t\t") + a.desc.unwrap_or_default().replace('\n', "\n\t\t") ); println!( diff --git a/src/main.rs b/src/main.rs index 8d77bc07..a194ec0a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -596,7 +596,7 @@ fn get_setup() -> Setup { let stripped_env_key = |k: &str| { k.trim_start_matches("LIBRESPOT_") - .replace("_", "-") + .replace('_', "-") .to_lowercase() };