redundant optimization; don't use extend_from_slice

gui-branch
an 2019-03-18 17:28:07 -04:00
parent 7e5375f32c
commit 32855fa213
2 changed files with 3 additions and 4 deletions

View File

@ -202,7 +202,7 @@ fn stream_literal(v: &mut Vec<u8>, b: &[u8], p: usize) -> ResultS<usize>
}
p += 4;
v.extend_from_slice(ok!(b.get(p..p + len), "not enough data")?);
v.extend(ok!(b.get(p..p + len), "not enough data")?);
Ok((p + len) * 8)
}

View File

@ -103,7 +103,7 @@ pub fn read_bitmap(b: &[u8]) -> ResultS<Bitmap>
bmp.cr.push(0);
}
bmp.cr.extend_from_slice(ok!(b.get(p..p + end), "not enough data")?);
bmp.cr.extend(ok!(b.get(p..p + end), "not enough data")?);
for _ in lst..pitch {
bmp.cr.push(0);
@ -113,8 +113,7 @@ pub fn read_bitmap(b: &[u8]) -> ResultS<Bitmap>
}
} else {
// simple copy
bmp.cr.extend_from_slice(ok!(b.get(p..p + width * height),
"not enough data")?);
bmp.cr.extend(ok!(b.get(p..p + width * height), "not enough data")?);
}
Ok(bmp)