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
19b06ae5fb
commit
64f9283b67
3 changed files with 7 additions and 8 deletions
|
@ -16,7 +16,7 @@ pub struct APResolveData {
|
||||||
pub fn apresolve(handle: &Handle) -> Box<Future<Item=String, Error=Error>> {
|
pub fn apresolve(handle: &Handle) -> Box<Future<Item=String, Error=Error>> {
|
||||||
let url = Url::parse(APRESOLVE_ENDPOINT).expect("invalid AP resolve URL");
|
let url = Url::parse(APRESOLVE_ENDPOINT).expect("invalid AP resolve URL");
|
||||||
|
|
||||||
let client = Client::new(&handle);
|
let client = Client::new(handle);
|
||||||
let response = client.get(url);
|
let response = client.get(url);
|
||||||
|
|
||||||
let body = response.and_then(|response| {
|
let body = response.and_then(|response| {
|
||||||
|
|
|
@ -128,13 +128,13 @@ impl Discovery {
|
||||||
|
|
||||||
let checksum_key = {
|
let checksum_key = {
|
||||||
let mut h = crypto::hmac::Hmac::new(crypto::sha1::Sha1::new(), &base_key);
|
let mut h = crypto::hmac::Hmac::new(crypto::sha1::Sha1::new(), &base_key);
|
||||||
h.input("checksum".as_bytes());
|
h.input(b"checksum");
|
||||||
h.result().code().to_owned()
|
h.result().code().to_owned()
|
||||||
};
|
};
|
||||||
|
|
||||||
let encryption_key = {
|
let encryption_key = {
|
||||||
let mut h = crypto::hmac::Hmac::new(crypto::sha1::Sha1::new(), &base_key);
|
let mut h = crypto::hmac::Hmac::new(crypto::sha1::Sha1::new(), &base_key);
|
||||||
h.input("encryption".as_bytes());
|
h.input(b"encryption");
|
||||||
h.result().code().to_owned()
|
h.result().code().to_owned()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -149,9 +149,8 @@ impl Discovery {
|
||||||
let decrypted = {
|
let decrypted = {
|
||||||
let mut data = vec![0u8; encrypted.len()];
|
let mut data = vec![0u8; encrypted.len()];
|
||||||
let mut cipher = crypto::aes::ctr(crypto::aes::KeySize::KeySize128,
|
let mut cipher = crypto::aes::ctr(crypto::aes::KeySize::KeySize128,
|
||||||
&encryption_key[0..16],
|
&encryption_key[0..16], iv);
|
||||||
&iv);
|
cipher.process(encrypted, &mut data);
|
||||||
cipher.process(&encrypted, &mut data);
|
|
||||||
String::from_utf8(data).unwrap()
|
String::from_utf8(data).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ fn deserialize_protobuf_enum<T, D>(de: D) -> Result<T, D::Error>
|
||||||
where T: ProtobufEnum, D: serde::Deserializer {
|
where T: ProtobufEnum, D: serde::Deserializer {
|
||||||
|
|
||||||
let v : i32 = try!(serde::Deserialize::deserialize(de));
|
let v : i32 = try!(serde::Deserialize::deserialize(de));
|
||||||
T::from_i32(v).ok_or(serde::de::Error::custom("Invalid enum value"))
|
T::from_i32(v).ok_or_else(|| serde::de::Error::custom("Invalid enum value"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_base64<T, S>(v: &T, ser: S) -> Result<S::Ok, S::Error>
|
fn serialize_base64<T, S>(v: &T, ser: S) -> Result<S::Ok, S::Error>
|
||||||
|
@ -197,7 +197,7 @@ pub fn get_credentials(device_name: &str, device_id: &str,
|
||||||
|
|
||||||
(None, _, None) => {
|
(None, _, None) => {
|
||||||
info!("No username provided and no stored credentials, starting discovery ...");
|
info!("No username provided and no stored credentials, starting discovery ...");
|
||||||
discovery_login(device_name.clone(), device_id.clone()).unwrap()
|
discovery_login(device_name, device_id).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue