Fix clippy warnings

This commit is contained in:
JasonLG1979 2022-03-19 22:12:24 -05:00
parent dc9f822c80
commit d887d58251
4 changed files with 19 additions and 26 deletions

View file

@ -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;

View file

@ -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 })
}

View file

@ -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!(

View file

@ -596,7 +596,7 @@ fn get_setup() -> Setup {
let stripped_env_key = |k: &str| {
k.trim_start_matches("LIBRESPOT_")
.replace("_", "-")
.replace('_', "-")
.to_lowercase()
};