]> git.nihav.org Git - nihav.git/commitdiff
fix clippy warnings
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 17 Nov 2021 12:43:19 +0000 (13:43 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 17 Nov 2021 12:43:19 +0000 (13:43 +0100)
nihav-commonfmt/src/codecs/jpeg.rs
nihav-commonfmt/src/codecs/rawvideo.rs
nihav-commonfmt/src/codecs/rawvideo_ms.rs
nihav-commonfmt/src/demuxers/y4m.rs
nihav-llaudio/src/demuxers/flac.rs

index 099aff9633e21c4e5653e0b9f9d141a50a9f5e74..693ead48dd409ba2b8d915cbc1fa2d57f07588ab 100644 (file)
@@ -63,6 +63,7 @@ fn idct_row(row: &mut [i16]) {
 }
 
 #[allow(clippy::erasing_op)]
+#[allow(clippy::identity_op)]
 fn idct_col(blk: &mut [i16; 64], off: usize) {
     let in0 = ((i32::from(blk[off + 0*8])) << 8) + (1 << (COL_SHIFT - 1));
     let in1 =  (i32::from(blk[off + 4*8])) << 8;
@@ -236,6 +237,7 @@ impl JPEGDecoder {
         self.depth      = 0;
     }
 
+    #[allow(clippy::many_single_char_names)]
     fn parse_sof(&mut self, br: &mut ByteReader) -> DecoderResult<NABufferType> {
         validate!(self.width == 0);
 
index 884f7c9a6f4a54fa6d663e884aabc86bfb960eee..13bd18729becfd96298147a7e558257787da185a 100644 (file)
@@ -57,7 +57,7 @@ impl NADecoder for RawDecoder {
                     }
                     validate!(off == src.len());
 
-                    NABufferType::Video(NAVideoBuffer::from_raw_parts(vinfo.clone(), src.clone(), offs, strides).into_ref())
+                    NABufferType::Video(NAVideoBuffer::from_raw_parts(*vinfo, src, offs, strides).into_ref())
                 } else {
                     let esize = vinfo.format.elem_size as usize;
                     let ychr = vinfo.format.get_chromaton(0).unwrap();
@@ -65,7 +65,7 @@ impl NADecoder for RawDecoder {
                     let stride = (width * esize + ystep - 1) / ystep;
                     let offs    = vec![0];
                     let strides = vec![stride];
-                    NABufferType::VideoPacked(NAVideoBuffer::from_raw_parts(vinfo.clone(), src.clone(), offs, strides).into_ref())
+                    NABufferType::VideoPacked(NAVideoBuffer::from_raw_parts(*vinfo, src, offs, strides).into_ref())
                 };
 
             let mut frm = NAFrame::new_from_pkt(pkt, self.info.clone(), buf);
index 0b35881c1204a645a7576389ee5dea89b97a61cb..a445cfd64e7cb1cad70192e386f2a47b120b8b93 100644 (file)
@@ -50,7 +50,7 @@ impl NADecoder for RawDecoder {
 
                         let sstride = (vinfo.width + 3) & !3;
 
-                        let buf = alloc_video_buffer(vinfo.clone(), 0)?;
+                        let buf = alloc_video_buffer(*vinfo, 0)?;
 
                         let mut frm = buf.get_vbuf().unwrap();
                         let dstride = frm.get_stride(0);
@@ -66,7 +66,7 @@ impl NADecoder for RawDecoder {
                     15 | 16 => {
                         let sstride = (vinfo.width * 2 + 3) & !3;
 
-                        let buf = alloc_video_buffer(vinfo.clone(), 0)?;
+                        let buf = alloc_video_buffer(*vinfo, 0)?;
 
                         let mut frm = buf.get_vbuf16().unwrap();
                         let dstride = frm.get_stride(0);
@@ -86,7 +86,7 @@ impl NADecoder for RawDecoder {
                         let offs    = vec![0; ncomp];
                         let mut strides = vec![0; ncomp];
                         strides[0] = sstride;
-                         NABufferType::VideoPacked(NAVideoBuffer::from_raw_parts(vinfo.clone(), src.clone(), offs, strides).into_ref())
+                         NABufferType::VideoPacked(NAVideoBuffer::from_raw_parts(*vinfo, src, offs, strides).into_ref())
                     },
                     _ => return Err(DecoderError::NotImplemented),
                 };
index 093d4441e79bf151e854c143fc509ad73520a6cb..f3030604e5d1e90c0081bc0c8aa82fd04d111da6 100644 (file)
@@ -20,7 +20,7 @@ impl<'a> DemuxCore<'a> for Y4MDemuxer<'a> {
         let vhdr = NAVideoInfo::new(self.width, self.height, false, format);
         let vci = NACodecTypeInfo::Video(vhdr);
         let vinfo = NACodecInfo::new("rawvideo", vci, None);
-        if let None = strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, self.fps_num, self.fps_den, 0)) {
+        if strmgr.add_stream(NAStream::new(StreamType::Video, 0, vinfo, self.fps_num, self.fps_den, 0)).is_none() {
             return Err(DemuxerError::MemoryError);
         }
 
index c20bc3d36791a10b3126dc2efb6417d370978f61..83208c406cf9034446bf36c9d12364c0c891ddf3 100644 (file)
@@ -89,7 +89,7 @@ impl<'a> FLACDemuxer<'a> {
                         1 => 192,
                         2..=5 => 576 << (bsz_id - 2),
                         6 => {
-                            validate!(idx + 1 <= buf.len());
+                            validate!(idx < buf.len());
                             u64::from(buf[idx]) + 1
                         },
                         7 => {