Fix clippy warnings

This commit is contained in:
Roderick van Domburg 2021-09-01 21:25:32 +02:00
parent 1540636ccc
commit b016b69772
No known key found for this signature in database
GPG key ID: FE2585E713F9F30A
5 changed files with 8 additions and 8 deletions

View file

@ -18,8 +18,8 @@ pub struct AudioDecrypt<T: io::Read> {
impl<T: io::Read> AudioDecrypt<T> { impl<T: io::Read> AudioDecrypt<T> {
pub fn new(key: AudioKey, reader: T) -> AudioDecrypt<T> { pub fn new(key: AudioKey, reader: T) -> AudioDecrypt<T> {
let cipher = Aes128Ctr::new( let cipher = Aes128Ctr::new(
&GenericArray::from_slice(&key.0), GenericArray::from_slice(&key.0),
&GenericArray::from_slice(&AUDIO_AESIV), GenericArray::from_slice(&AUDIO_AESIV),
); );
AudioDecrypt { cipher, reader } AudioDecrypt { cipher, reader }
} }

View file

@ -1033,7 +1033,7 @@ impl SpircTask {
.payload .payload
.first() .first()
.expect("Empty payload on context uri"); .expect("Empty payload on context uri");
let response: serde_json::Value = serde_json::from_slice(&data).unwrap(); let response: serde_json::Value = serde_json::from_slice(data).unwrap();
Ok(response) Ok(response)
} }
@ -1051,7 +1051,7 @@ impl SpircTask {
if let Some(head) = track_vec.len().checked_sub(CONTEXT_TRACKS_HISTORY) { if let Some(head) = track_vec.len().checked_sub(CONTEXT_TRACKS_HISTORY) {
track_vec.drain(0..head); track_vec.drain(0..head);
} }
track_vec.extend_from_slice(&new_tracks); track_vec.extend_from_slice(new_tracks);
self.state self.state
.set_track(protobuf::RepeatedField::from_vec(track_vec)); .set_track(protobuf::RepeatedField::from_vec(track_vec));
@ -1218,7 +1218,7 @@ impl SpircTask {
trace!("Sending status to server: [{}]", status_string); trace!("Sending status to server: [{}]", status_string);
let mut cs = CommandSender::new(self, MessageType::kMessageTypeNotify); let mut cs = CommandSender::new(self, MessageType::kMessageTypeNotify);
if let Some(s) = recipient { if let Some(s) = recipient {
cs = cs.recipient(&s); cs = cs.recipient(s);
} }
cs.send(); cs.send();
} }

View file

@ -124,7 +124,7 @@ fn compute_keys(shared_secret: &[u8], packets: &[u8]) -> (Vec<u8>, Vec<u8>, Vec<
let mut data = Vec::with_capacity(0x64); let mut data = Vec::with_capacity(0x64);
for i in 1..6 { for i in 1..6 {
let mut mac = let mut mac =
HmacSha1::new_from_slice(&shared_secret).expect("HMAC can take key of any size"); HmacSha1::new_from_slice(shared_secret).expect("HMAC can take key of any size");
mac.update(packets); mac.update(packets);
mac.update(&[i]); mac.update(&[i]);
data.extend_from_slice(&mac.finalize().into_bytes()); data.extend_from_slice(&mac.finalize().into_bytes());

View file

@ -126,7 +126,7 @@ pub trait Metadata: Send + Sized + 'static {
let data = response.payload.first().expect("Empty payload"); let data = response.payload.first().expect("Empty payload");
let msg = Self::Message::parse_from_bytes(data).unwrap(); let msg = Self::Message::parse_from_bytes(data).unwrap();
Ok(Self::parse(&msg, &session)) Ok(Self::parse(&msg, session))
} }
} }

View file

@ -59,7 +59,7 @@ fn list_outputs() -> io::Result<()> {
println!("Listing available Alsa outputs:"); println!("Listing available Alsa outputs:");
for t in &["pcm", "ctl", "hwdep"] { for t in &["pcm", "ctl", "hwdep"] {
println!("{} devices:", t); println!("{} devices:", t);
let i = match HintIter::new_str(None, &t) { let i = match HintIter::new_str(None, t) {
Ok(i) => i, Ok(i) => i,
Err(e) => { Err(e) => {
return Err(io::Error::new(io::ErrorKind::Other, e)); return Err(io::Error::new(io::ErrorKind::Other, e));