Remove pointless Vec

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
Serial 2021-07-08 18:06:00 -04:00
parent 7dd852d7b7
commit f9c2321ba1

View file

@ -34,26 +34,22 @@ pub(crate) fn create_pages(
packet.extend(comments_len.to_le_bytes().iter()); packet.extend(comments_len.to_le_bytes().iter());
let mut comment_str = Vec::new();
for (a, b) in comments { for (a, b) in comments {
comment_str.push(format!("{}={}", a, b)); let comment = format!("{}={}", a, b);
let last = comment_str.last().unwrap(); let comment_b = comment.as_bytes();
let len = last.as_bytes().len() as u32; packet.extend((comment_b.len() as u32).to_le_bytes().iter());
packet.extend(len.to_le_bytes().iter()); packet.extend(comment_b.iter());
packet.extend(last.as_bytes().iter());
} }
if let Some(pics) = pictures { if let Some(pics) = pictures {
for pic in pics.iter() { for pic in pics.iter() {
comment_str.push(format!( let comment = format!(
"METADATA_BLOCK_PICTURE={}", "METADATA_BLOCK_PICTURE={}",
base64::encode(pic.as_apic_bytes()) base64::encode(pic.as_apic_bytes())
)); );
let last = comment_str.last().unwrap(); let comment_b = comment.as_bytes();
let len = last.as_bytes().len() as u32; packet.extend((comment_b.len() as u32).to_le_bytes().iter());
packet.extend(len.to_le_bytes().iter()); packet.extend(comment_b.iter());
packet.extend(last.as_bytes().iter());
} }
} }