1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

Fix clippy lints

This commit is contained in:
Roderick van Domburg 2022-05-21 21:36:56 +02:00
parent 3d298768b3
commit 2a3e248bba
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
7 changed files with 30 additions and 40 deletions

View file

@ -10,7 +10,6 @@ edition = "2018"
[dependencies]
aes-ctr = "0.6"
base64 = "0.13"
cfg-if = "1.0"
form_urlencoded = "1.0"
futures-core = "0.3"
hmac = "0.11"

View file

@ -16,7 +16,6 @@ use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use cfg_if::cfg_if;
use futures_core::Stream;
use librespot_core as core;
use thiserror::Error;
@ -100,29 +99,24 @@ 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=/"],
)
.map_err(|e| Error::DnsSdError(io::Error::new(io::ErrorKind::Unsupported, e)))?;
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=/"],
).map_err(|e| Error::DnsSdError(io::Error::new(io::ErrorKind::Unsupported, e)))?;
} 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 })
}