mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Fix clippy warnings
This commit is contained in:
parent
dc9f822c80
commit
d887d58251
4 changed files with 19 additions and 26 deletions
|
@ -257,7 +257,7 @@ impl SpClient {
|
||||||
let mut tries: usize = 0;
|
let mut tries: usize = 0;
|
||||||
let mut last_response;
|
let mut last_response;
|
||||||
|
|
||||||
let body = body.unwrap_or_else(String::new);
|
let body = body.unwrap_or_default();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tries += 1;
|
tries += 1;
|
||||||
|
|
|
@ -16,7 +16,6 @@ use std::{
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
|
||||||
use futures_core::Stream;
|
use futures_core::Stream;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
@ -117,11 +116,8 @@ impl Builder {
|
||||||
let name = self.server_config.name.clone().into_owned();
|
let name = self.server_config.name.clone().into_owned();
|
||||||
let server = DiscoveryServer::new(self.server_config, &mut port)??;
|
let server = DiscoveryServer::new(self.server_config, &mut port)??;
|
||||||
|
|
||||||
let svc;
|
#[cfg(feature = "with-dns-sd")]
|
||||||
|
let svc = dns_sd::DNSService::register(
|
||||||
cfg_if! {
|
|
||||||
if #[cfg(feature = "with-dns-sd")] {
|
|
||||||
svc = dns_sd::DNSService::register(
|
|
||||||
Some(name.as_ref()),
|
Some(name.as_ref()),
|
||||||
"_spotify-connect._tcp",
|
"_spotify-connect._tcp",
|
||||||
None,
|
None,
|
||||||
|
@ -130,16 +126,13 @@ impl Builder {
|
||||||
&["VERSION=1.0", "CPath=/"],
|
&["VERSION=1.0", "CPath=/"],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
} else {
|
#[cfg(not(feature = "with-dns-sd"))]
|
||||||
let responder = libmdns::Responder::spawn(&tokio::runtime::Handle::current())?;
|
let svc = libmdns::Responder::spawn(&tokio::runtime::Handle::current())?.register(
|
||||||
svc = responder.register(
|
|
||||||
"_spotify-connect._tcp".to_owned(),
|
"_spotify-connect._tcp".to_owned(),
|
||||||
name,
|
name,
|
||||||
port,
|
port,
|
||||||
&["VERSION=1.0", "CPath=/"],
|
&["VERSION=1.0", "CPath=/"],
|
||||||
)
|
);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(Discovery { server, _svc: svc })
|
Ok(Discovery { server, _svc: svc })
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ fn list_compatible_devices() -> SinkResult<()> {
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"\tDescription:\n\n\t\t{}\n",
|
"\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!(
|
println!(
|
||||||
|
|
|
@ -596,7 +596,7 @@ fn get_setup() -> Setup {
|
||||||
|
|
||||||
let stripped_env_key = |k: &str| {
|
let stripped_env_key = |k: &str| {
|
||||||
k.trim_start_matches("LIBRESPOT_")
|
k.trim_start_matches("LIBRESPOT_")
|
||||||
.replace("_", "-")
|
.replace('_', "-")
|
||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue