Fix various clippy warnings in gstreamer-video

This commit is contained in:
Sebastian Dröge 2017-09-10 14:27:00 +03:00
parent d99e15aa30
commit 3b66ea66e1
2 changed files with 6 additions and 8 deletions

View file

@ -138,11 +138,11 @@ impl VideoFormatInfo {
} }
pub fn scale_width(&self, component: u8, width: u32) -> u32 { pub fn scale_width(&self, component: u8, width: u32) -> u32 {
(-((-(width as i64)) >> self.w_sub()[component as usize])) as u32 (-((-(i64::from(width))) >> self.w_sub()[component as usize])) as u32
} }
pub fn scale_height(&self, component: u8, height: u32) -> u32 { pub fn scale_height(&self, component: u8, height: u32) -> u32 {
(-((-(height as i64)) >> self.h_sub()[component as usize])) as u32 (-((-(i64::from(height))) >> self.h_sub()[component as usize])) as u32
} }
// TODO: pack/unpack // TODO: pack/unpack

View file

@ -242,9 +242,8 @@ impl<'a> VideoInfoBuilder<'a> {
return None; return None;
} }
for i in 0..((*info.finfo).n_planes as usize) { let n_planes = (*info.finfo).n_planes as usize;
info.offset[i] = offset[i]; info.offset[..n_planes].copy_from_slice(&offset[..n_planes]);
}
} }
if let Some(stride) = self.stride { if let Some(stride) = self.stride {
@ -252,9 +251,8 @@ impl<'a> VideoInfoBuilder<'a> {
return None; return None;
} }
for i in 0..((*info.finfo).n_planes as usize) { let n_planes = (*info.finfo).n_planes as usize;
info.stride[i] = stride[i]; info.stride[..n_planes].copy_from_slice(&stride[..n_planes]);
}
} }
if let Some(multiview_mode) = self.multiview_mode { if let Some(multiview_mode) = self.multiview_mode {