diff --git a/src/icon.rs b/src/icon.rs index 4294e70..f728b6b 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -352,10 +352,10 @@ impl Icon { }; if let Some(hashmap) = &icon_state.unknown_settings { - for (setting, value) in hashmap.iter() { - signature.push_str(&format!("\t{} = {}\n", setting, value)); - } - }; + for (setting, value) in hashmap.iter() { + signature.push_str(&format!("\t{} = {}\n", setting, value)); + } + }; sprites.extend(icon_state.images.iter()); } @@ -403,8 +403,8 @@ impl Icon { /// animated [IconState] /// /// - `Indefinitely`: Loop repeatedly as long as the [IconState] is displayed -/// - `NTimes(NonZeroU32)`: Loop N times before freezing on the final frame. Stored as a `NonZeroU32` -/// +/// - `NTimes(NonZeroU32)`: Loop N times before freezing on the final frame. Stored as a `NonZeroU32` +/// /// For memory efficiency reasons, looping 0 times is an invalid state. /// /// This type is effectively a newtype of `Option`. As such, `From` is diff --git a/src/lib.rs b/src/lib.rs index 102c021..e97250d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -141,39 +141,39 @@ impl RawDmi { }; if let Some(chunk_ztxt) = &self.chunk_ztxt { - let bytes_written = chunk_ztxt.save(&mut writter)?; - total_bytes_written += bytes_written; - if bytes_written < u32::from_be_bytes(chunk_ztxt.data_length) as usize + 12 { - return Err(error::DmiError::Generic(format!( - "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", - total_bytes_written - ))); - }; - }; + let bytes_written = chunk_ztxt.save(&mut writter)?; + total_bytes_written += bytes_written; + if bytes_written < u32::from_be_bytes(chunk_ztxt.data_length) as usize + 12 { + return Err(error::DmiError::Generic(format!( + "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", + total_bytes_written + ))); + }; + }; if let Some(chunk_plte) = &self.chunk_plte { - let bytes_written = chunk_plte.save(&mut writter)?; - total_bytes_written += bytes_written; - if bytes_written < u32::from_be_bytes(chunk_plte.data_length) as usize + 12 { - return Err(error::DmiError::Generic(format!( - "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", - total_bytes_written - ))); - }; - }; + let bytes_written = chunk_plte.save(&mut writter)?; + total_bytes_written += bytes_written; + if bytes_written < u32::from_be_bytes(chunk_plte.data_length) as usize + 12 { + return Err(error::DmiError::Generic(format!( + "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", + total_bytes_written + ))); + }; + }; if let Some(other_chunks) = &self.other_chunks { - for chunk in other_chunks { - let bytes_written = chunk.save(&mut writter)?; - total_bytes_written += bytes_written; - if bytes_written < u32::from_be_bytes(chunk.data_length) as usize + 12 { - return Err(error::DmiError::Generic(format!( - "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", - total_bytes_written - ))); - }; - } - } + for chunk in other_chunks { + let bytes_written = chunk.save(&mut writter)?; + total_bytes_written += bytes_written; + if bytes_written < u32::from_be_bytes(chunk.data_length) as usize + 12 { + return Err(error::DmiError::Generic(format!( + "Failed to save DMI. Buffer unable to hold the data, only {} bytes written.", + total_bytes_written + ))); + }; + } + } for chunk in &self.chunks_idat { let bytes_written = chunk.save(&mut writter)?;