polishing compact_integers

This commit is contained in:
debris 2016-09-18 17:09:36 +02:00
parent 7f1bc7de05
commit 0fba932c47
1 changed files with 4 additions and 4 deletions

View File

@ -85,10 +85,10 @@ impl Serializable for CompactInteger {
impl Deserializable for CompactInteger {
fn deserialize(reader: &mut Reader) -> Result<Self, ReaderError> where Self: Sized {
let result = match try!(reader.read::<u8>()) {
i @ 0...0xfc => CompactInteger::from(i),
0xfd => CompactInteger::from(try!(reader.read::<u16>())),
0xfe => CompactInteger::from(try!(reader.read::<u32>())),
_ => CompactInteger::from(try!(reader.read::<u64>())),
i @ 0...0xfc => i.into(),
0xfd => try!(reader.read::<u16>()).into(),
0xfe => try!(reader.read::<u32>()).into(),
_ => try!(reader.read::<u64>()).into(),
};
Ok(result)