Skip to content

Commit a676dfa

Browse files
committedApr 28, 2023
Remove MemDecoder::read_byte.
It's just a synonym for `read_u8`.
1 parent 7a16d25 commit a676dfa

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed
 

‎compiler/rustc_serialize/src/opaque.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -504,19 +504,6 @@ impl<'a> MemDecoder<'a> {
504504
panic!("MemDecoder exhausted")
505505
}
506506

507-
#[inline]
508-
fn read_byte(&mut self) -> u8 {
509-
if self.current == self.end {
510-
Self::decoder_exhausted();
511-
}
512-
// SAFETY: This type guarantees current <= end, and we just checked current == end.
513-
unsafe {
514-
let byte = *self.current;
515-
self.current = self.current.add(1);
516-
byte
517-
}
518-
}
519-
520507
#[inline]
521508
fn read_array<const N: usize>(&mut self) -> [u8; N] {
522509
self.read_raw_bytes(N).try_into().unwrap()
@@ -586,7 +573,15 @@ impl<'a> Decoder for MemDecoder<'a> {
586573

587574
#[inline]
588575
fn read_u8(&mut self) -> u8 {
589-
self.read_byte()
576+
if self.current == self.end {
577+
Self::decoder_exhausted();
578+
}
579+
// SAFETY: This type guarantees current <= end, and we just checked current == end.
580+
unsafe {
581+
let byte = *self.current;
582+
self.current = self.current.add(1);
583+
byte
584+
}
590585
}
591586

592587
#[inline]

0 commit comments

Comments
 (0)
Please sign in to comment.