From 32855fa2138b6e73e2528c53f39b28d68dc30c1a Mon Sep 17 00:00:00 2001 From: Marrub Date: Mon, 18 Mar 2019 17:28:07 -0400 Subject: [PATCH] redundant optimization; don't use extend_from_slice --- source/marathon/defl.rs | 2 +- source/marathon/shp.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/marathon/defl.rs b/source/marathon/defl.rs index 2580240..0693647 100644 --- a/source/marathon/defl.rs +++ b/source/marathon/defl.rs @@ -202,7 +202,7 @@ fn stream_literal(v: &mut Vec, b: &[u8], p: usize) -> ResultS } 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) } diff --git a/source/marathon/shp.rs b/source/marathon/shp.rs index a387234..d310497 100644 --- a/source/marathon/shp.rs +++ b/source/marathon/shp.rs @@ -103,7 +103,7 @@ pub fn read_bitmap(b: &[u8]) -> ResultS 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 } } 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)