Delete Decoder::read_unit

This commit is contained in:
Mark Rousskov 2022-02-22 18:14:51 -05:00
parent 2098ea6eba
commit f1bcb0f3af
5 changed files with 4 additions and 17 deletions

View File

@ -2418,8 +2418,7 @@ impl<S: Encoder> rustc_serialize::Encodable<S> for AttrId {
} }
impl<D: Decoder> rustc_serialize::Decodable<D> for AttrId { impl<D: Decoder> rustc_serialize::Decodable<D> for AttrId {
fn decode(d: &mut D) -> AttrId { fn decode(_: &mut D) -> AttrId {
d.read_unit();
crate::attr::mk_attr_id() crate::attr::mk_attr_id()
} }
} }

View File

@ -63,8 +63,7 @@ impl<S: serialize::Encoder> serialize::Encodable<S> for PredecessorCache {
impl<D: serialize::Decoder> serialize::Decodable<D> for PredecessorCache { impl<D: serialize::Decoder> serialize::Decodable<D> for PredecessorCache {
#[inline] #[inline]
fn decode(d: &mut D) -> Self { fn decode(_: &mut D) -> Self {
let () = d.read_unit();
Self::new() Self::new()
} }
} }

View File

@ -465,8 +465,6 @@ macro_rules! implement_ty_decoder {
impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> { impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> {
$crate::__impl_decoder_methods! { $crate::__impl_decoder_methods! {
read_unit -> ();
read_u128 -> u128; read_u128 -> u128;
read_u64 -> u64; read_u64 -> u64;
read_u32 -> u32; read_u32 -> u32;

View File

@ -555,11 +555,6 @@ macro_rules! read_leb128 {
} }
impl<'a> serialize::Decoder for Decoder<'a> { impl<'a> serialize::Decoder for Decoder<'a> {
#[inline]
fn read_unit(&mut self) -> () {
()
}
#[inline] #[inline]
fn read_u128(&mut self) -> u128 { fn read_u128(&mut self) -> u128 {
read_leb128!(self, read_u128_leb128) read_leb128!(self, read_u128_leb128)

View File

@ -181,7 +181,6 @@ pub trait Encoder {
// concise. // concise.
pub trait Decoder { pub trait Decoder {
// Primitive types: // Primitive types:
fn read_unit(&mut self) -> ();
fn read_usize(&mut self) -> usize; fn read_usize(&mut self) -> usize;
fn read_u128(&mut self) -> u128; fn read_u128(&mut self) -> u128;
fn read_u64(&mut self) -> u64; fn read_u64(&mut self) -> u64;
@ -324,9 +323,7 @@ impl<S: Encoder> Encodable<S> for () {
} }
impl<D: Decoder> Decodable<D> for () { impl<D: Decoder> Decodable<D> for () {
fn decode(d: &mut D) -> () { fn decode(_: &mut D) -> () {}
d.read_unit()
}
} }
impl<S: Encoder, T> Encodable<S> for PhantomData<T> { impl<S: Encoder, T> Encodable<S> for PhantomData<T> {
@ -336,8 +333,7 @@ impl<S: Encoder, T> Encodable<S> for PhantomData<T> {
} }
impl<D: Decoder, T> Decodable<D> for PhantomData<T> { impl<D: Decoder, T> Decodable<D> for PhantomData<T> {
fn decode(d: &mut D) -> PhantomData<T> { fn decode(_: &mut D) -> PhantomData<T> {
d.read_unit();
PhantomData PhantomData
} }
} }