Use iter() instead of into_iter() where appropriate.

This commit is contained in:
KAMADA Ken'ichi 2020-01-08 22:52:44 +09:00
parent 3c928122eb
commit faefc75601
2 changed files with 3 additions and 6 deletions

View File

@ -364,9 +364,8 @@ fn parse_rational<E>(data: &[u8], offset: usize, count: usize)
}
fn parse_sbyte(data: &[u8], offset: usize, count: usize) -> Value {
let bytes = data[offset .. offset + count].into_iter()
.map(|x| *x as i8)
.collect();
let bytes = data[offset .. offset + count].iter()
.map(|x| *x as i8).collect();
Value::SByte(bytes)
}

View File

@ -502,9 +502,7 @@ fn compose_value<E>(value: &Value)
Ok((5, vec.len(), buf))
},
Value::SByte(ref vec) => {
let bytes = vec.into_iter()
.map(|x| *x as u8)
.collect();
let bytes = vec.iter().map(|x| *x as u8).collect();
Ok((6, vec.len(), bytes))
},
Value::Undefined(ref s, _) =>