mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
Remove pointless Vec
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
7dd852d7b7
commit
f9c2321ba1
1 changed files with 9 additions and 13 deletions
|
@ -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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue