Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Luni-4 committed Sep 2, 2022
1 parent 83567ed commit dca2a43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,16 @@ mod tests {
loop {
let p = e.get_packet();

if p.is_none() {
break;
} else if let VPXPacket::Packet(ref pkt) = p.unwrap() {
if let Some(VPXPacket::Packet(ref pkt)) = p {
d.decode(&pkt.data, None).unwrap();

// No multiframe expected.
if let Some(f) = d.get_frame() {
out = 1;
println!("{:#?}", f);
}
} else {
break;
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ mod encoder_trait {

fn send_frame(&mut self, frame: &ArcFrame) -> Result<()> {
let enc = self.enc.as_mut().unwrap();
enc.encode(frame).map_err(|e| match e {
_ => unimplemented!(),
})
enc.encode(frame).map_err(|_| unimplemented!())
}

fn receive_packet(&mut self) -> Result<Packet> {
Expand All @@ -359,9 +357,7 @@ mod encoder_trait {

fn flush(&mut self) -> Result<()> {
let enc = self.enc.as_mut().unwrap();
enc.flush().map_err(|e| match e {
_ => unimplemented!(),
})
enc.flush().map_err(|_| unimplemented!())
}

fn set_option<'a>(&mut self, key: &str, val: Value<'a>) -> Result<()> {
Expand Down
5 changes: 3 additions & 2 deletions vpx-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ mod tests {
if ret.is_null() {
panic!("Image allocation failed");
}
mem::forget(ret); // raw and ret are the same
#[allow(clippy::forget_copy)]
mem::forget(ret); // raw and ret are the same (ret does not implement Drop trait)
print!("{:#?}", raw);

let mut cfg = MaybeUninit::uninit();
Expand All @@ -57,7 +58,7 @@ mod tests {
vpx_codec_enc_init_ver(
ctx.as_mut_ptr(),
vpx_codec_vp9_cx(),
&mut cfg,
&cfg,
0,
VPX_ENCODER_ABI_VERSION as i32,
)
Expand Down

0 comments on commit dca2a43

Please sign in to comment.