redundant optimization; don't use extend_from_slice
parent
7e5375f32c
commit
32855fa213
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue