From 04dcdb41ab4f0ea08e95b477e55d5c35c489b86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Fri, 19 Aug 2022 21:35:58 +0200 Subject: [PATCH] Run rustfmt --- src/headers.rs | 8 +++----- src/lib.rs | 2 +- src/png/mod.rs | 8 ++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/headers.rs b/src/headers.rs index 0a3e2cee..1183ca69 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -1,9 +1,9 @@ -use std::io; use crate::colors::{BitDepth, ColorType}; use crate::error::PngError; use crate::PngResult; use crc::{Crc, CRC_32_ISO_HDLC}; use indexmap::IndexSet; +use std::io; use std::io::{Cursor, Read}; #[derive(Debug, Clone, Copy)] @@ -163,10 +163,8 @@ pub fn parse_ihdr_header(byte_data: &[u8]) -> PngResult { 16 => BitDepth::Sixteen, _ => return Err(PngError::new("Unexpected bit depth in header")), }, - width: read_be_u32(&mut rdr) - .map_err(|_| PngError::TruncatedData)?, - height: read_be_u32(&mut rdr) - .map_err(|_| PngError::TruncatedData)?, + width: read_be_u32(&mut rdr).map_err(|_| PngError::TruncatedData)?, + height: read_be_u32(&mut rdr).map_err(|_| PngError::TruncatedData)?, compression: byte_data[10], filter: byte_data[11], interlaced, diff --git a/src/lib.rs b/src/lib.rs index d5857e6f..441d8849 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ use log::{debug, error, info, warn}; use rayon::prelude::*; use std::fmt; use std::fs::{copy, File, Metadata}; -use std::io::{stdin, stdout, BufWriter, Read, Write, Cursor}; +use std::io::{stdin, stdout, BufWriter, Cursor, Read, Write}; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; diff --git a/src/png/mod.rs b/src/png/mod.rs index 1c82aef0..b625de9c 100644 --- a/src/png/mod.rs +++ b/src/png/mod.rs @@ -175,9 +175,13 @@ impl PngData { // IHDR let mut ihdr_data = Vec::with_capacity(13); ihdr_data.write_all(&self.raw.ihdr.width.to_be_bytes()).ok(); - ihdr_data.write_all(&self.raw.ihdr.height.to_be_bytes()).ok(); + ihdr_data + .write_all(&self.raw.ihdr.height.to_be_bytes()) + .ok(); ihdr_data.write_all(&[self.raw.ihdr.bit_depth.as_u8()]).ok(); - ihdr_data.write_all(&[self.raw.ihdr.color_type.png_header_code()]).ok(); + ihdr_data + .write_all(&[self.raw.ihdr.color_type.png_header_code()]) + .ok(); ihdr_data.write_all(&[0]).ok(); // Compression -- deflate ihdr_data.write_all(&[0]).ok(); // Filter method -- 5-way adaptive filtering ihdr_data.write_all(&[self.raw.ihdr.interlaced]).ok();