Fix Clippy warnings

This commit is contained in:
Paul Lietar 2017-02-09 01:32:18 +00:00
parent 19b06ae5fb
commit 64f9283b67
3 changed files with 7 additions and 8 deletions

View file

@ -16,7 +16,7 @@ pub struct APResolveData {
pub fn apresolve(handle: &Handle) -> Box<Future<Item=String, Error=Error>> {
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 body = response.and_then(|response| {

View file

@ -128,13 +128,13 @@ impl Discovery {
let checksum_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()
};
let encryption_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()
};
@ -149,9 +149,8 @@ impl Discovery {
let decrypted = {
let mut data = vec![0u8; encrypted.len()];
let mut cipher = crypto::aes::ctr(crypto::aes::KeySize::KeySize128,
&encryption_key[0..16],
&iv);
cipher.process(&encrypted, &mut data);
&encryption_key[0..16], iv);
cipher.process(encrypted, &mut data);
String::from_utf8(data).unwrap()
};

View file

@ -153,7 +153,7 @@ fn deserialize_protobuf_enum<T, D>(de: D) -> Result<T, D::Error>
where T: ProtobufEnum, D: serde::Deserializer {
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>
@ -197,7 +197,7 @@ pub fn get_credentials(device_name: &str, device_id: &str,
(None, _, None) => {
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()
}
}
}