Skip to content

Commit fa133f5

Browse files
committed
Remove a low-value assertion.
Checking that `read_raw_bytes(len)` changes the position by `len` is a reasonable thing for a test, but isn't much use in just one of the zillion `Decodable` impls.
1 parent 37c9e45 commit fa133f5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

compiler/rustc_serialize/src/opaque.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,7 @@ impl Encodable<FileEncoder> for IntEncodedWithFixedSize {
779779
impl<'a> Decodable<MemDecoder<'a>> for IntEncodedWithFixedSize {
780780
#[inline]
781781
fn decode(decoder: &mut MemDecoder<'a>) -> IntEncodedWithFixedSize {
782-
let _start_pos = decoder.position();
783-
let bytes = decoder.read_raw_bytes(IntEncodedWithFixedSize::ENCODED_SIZE);
784-
let value = u64::from_le_bytes(bytes.try_into().unwrap());
785-
let _end_pos = decoder.position();
786-
debug_assert_eq!((_end_pos - _start_pos), IntEncodedWithFixedSize::ENCODED_SIZE);
787-
788-
IntEncodedWithFixedSize(value)
782+
let bytes = decoder.read_array::<{ IntEncodedWithFixedSize::ENCODED_SIZE }>();
783+
IntEncodedWithFixedSize(u64::from_le_bytes(bytes))
789784
}
790785
}

0 commit comments

Comments
 (0)