X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fformats.rs;h=99370f9ab4c370f5cc155e1865b4ab71f2b7cafd;hb=9d2db2234d6c97dd13f6ca693d370b1e67bd8bed;hp=3501cb065ae8b8f85afd104c0598bffc1c55129c;hpb=73f0f89ff3a3616a8e65b5a31c2303725994c56a;p=nihav.git diff --git a/nihav-core/src/formats.rs b/nihav-core/src/formats.rs index 3501cb0..99370f9 100644 --- a/nihav-core/src/formats.rs +++ b/nihav-core/src/formats.rs @@ -428,8 +428,8 @@ impl ColorModel { impl fmt::Display for ColorModel { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let name = match *self { - ColorModel::RGB(fmt) => format!("RGB({})", fmt).to_string(), - ColorModel::YUV(fmt) => format!("YUV({})", fmt).to_string(), + ColorModel::RGB(fmt) => format!("RGB({})", fmt), + ColorModel::YUV(fmt) => format!("YUV({})", fmt), ColorModel::CMYK => "CMYK".to_string(), ColorModel::HSV => "HSV".to_string(), ColorModel::LAB => "LAB".to_string(), @@ -710,7 +710,7 @@ impl NAPixelFormaton { } ssamp } - #[allow(clippy::cyclomatic_complexity)] + #[allow(clippy::cognitive_complexity)] /// Returns a short string description of the format if possible. pub fn to_short_string(&self) -> Option { match self.model { @@ -1065,8 +1065,8 @@ fn parse_yuv_format(s: &str) -> Result { 444 => [[0, 0], [0, 0], [0, 0], [0, 0]], _ => return Err(FormatParseError {}), }; - for (chro, ss) in chromatons.iter_mut().take(components as usize).zip(subsamp.iter()) { - *chro = Some(NAPixelChromaton{ h_ss: ss[0], v_ss: ss[1], packed: !is_planar, depth, shift: 0, comp_offs: next_elem, next_elem }); + for (i, (chro, ss)) in chromatons.iter_mut().take(components as usize).zip(subsamp.iter()).enumerate() { + *chro = Some(NAPixelChromaton{ h_ss: ss[0], v_ss: ss[1], packed: !is_planar, depth, shift: 0, comp_offs: if is_planar { i as u8 } else { next_elem }, next_elem }); } Ok(NAPixelFormaton { model: ColorModel::YUV(YUVSubmodel::YUVJ), components, @@ -1078,6 +1078,7 @@ fn parse_yuv_format(s: &str) -> Result { impl FromStr for NAPixelFormaton { type Err = FormatParseError; + #[allow(clippy::single_match)] fn from_str(s: &str) -> Result { match s { "pal8" => return Ok(PAL8_FORMAT),