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 { fn parse_sbyte(data: &[u8], offset: usize, count: usize) -> Value {
let bytes = data[offset .. offset + count].into_iter() let bytes = data[offset .. offset + count].iter()
.map(|x| *x as i8) .map(|x| *x as i8).collect();
.collect();
Value::SByte(bytes) Value::SByte(bytes)
} }

View File

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