Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeWaka committed Nov 2, 2024
1 parent 553f188 commit c109cde
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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<NonZeroU32>`. As such, `From<Looping>` is
Expand Down
58 changes: 29 additions & 29 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit c109cde

Please sign in to comment.