diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-04-28 09:01:00 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-04-28 18:34:52 +1000 |
| commit | fa133f5354ac29096d1577d5ba9c1400c2ad3b0f (patch) | |
| tree | 44a9393f99b5177970f795b19fba03d5b765b144 /compiler/rustc_serialize/src | |
| parent | 37c9e45186e00c197902a7c7349c18383aa0abf7 (diff) | |
| download | rust-fa133f5354ac29096d1577d5ba9c1400c2ad3b0f.tar.gz rust-fa133f5354ac29096d1577d5ba9c1400c2ad3b0f.zip | |
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.
Diffstat (limited to 'compiler/rustc_serialize/src')
| -rw-r--r-- | compiler/rustc_serialize/src/opaque.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index 012a6406de3..6c18a8d0742 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -779,12 +779,7 @@ impl Encodable<FileEncoder> for IntEncodedWithFixedSize { impl<'a> Decodable<MemDecoder<'a>> for IntEncodedWithFixedSize { #[inline] fn decode(decoder: &mut MemDecoder<'a>) -> IntEncodedWithFixedSize { - let _start_pos = decoder.position(); - let bytes = decoder.read_raw_bytes(IntEncodedWithFixedSize::ENCODED_SIZE); - let value = u64::from_le_bytes(bytes.try_into().unwrap()); - let _end_pos = decoder.position(); - debug_assert_eq!((_end_pos - _start_pos), IntEncodedWithFixedSize::ENCODED_SIZE); - - IntEncodedWithFixedSize(value) + let bytes = decoder.read_array::<{ IntEncodedWithFixedSize::ENCODED_SIZE }>(); + IntEncodedWithFixedSize(u64::from_le_bytes(bytes)) } } |
