Remove emit_unit

It doesn't do anything for all encoders
This commit is contained in:
bjorn3 2021-06-04 18:32:00 +02:00
parent 22e8d5f80e
commit 7381ea019c
8 changed files with 12 additions and 33 deletions

View file

@ -2473,8 +2473,8 @@ rustc_index::newtype_index! {
}
impl<S: Encoder> rustc_serialize::Encodable<S> for AttrId {
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -95,11 +95,6 @@ macro_rules! encoder_methods {
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
type Error = <opaque::Encoder as Encoder>::Error;
#[inline]
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}
encoder_methods! {
emit_usize(usize);
emit_u128(u128);

View file

@ -56,8 +56,8 @@ impl PredecessorCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for PredecessorCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -56,8 +56,8 @@ impl SwitchSourceCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for SwitchSourceCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -367,8 +367,8 @@ impl PostorderCache {
impl<S: serialize::Encoder> serialize::Encodable<S> for PostorderCache {
#[inline]
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}

View file

@ -993,11 +993,6 @@ where
{
type Error = E::Error;
#[inline]
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}
encoder_methods! {
emit_usize(usize);
emit_u128(u128);

View file

@ -64,11 +64,6 @@ const STR_SENTINEL: u8 = 0xC1;
impl serialize::Encoder for Encoder {
type Error = !;
#[inline]
fn emit_unit(&mut self) -> EncodeResult {
Ok(())
}
#[inline]
fn emit_usize(&mut self, v: usize) -> EncodeResult {
write_leb128!(self, v, usize, write_usize_leb128)
@ -419,11 +414,6 @@ macro_rules! file_encoder_write_leb128 {
impl serialize::Encoder for FileEncoder {
type Error = io::Error;
#[inline]
fn emit_unit(&mut self) -> FileEncodeResult {
Ok(())
}
#[inline]
fn emit_usize(&mut self, v: usize) -> FileEncodeResult {
file_encoder_write_leb128!(self, v, usize, write_usize_leb128)

View file

@ -15,7 +15,6 @@ pub trait Encoder {
type Error;
// Primitive types:
fn emit_unit(&mut self) -> Result<(), Self::Error>;
fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>;
fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>;
fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
@ -203,8 +202,8 @@ impl<D: Decoder> Decodable<D> for String {
}
impl<S: Encoder> Encodable<S> for () {
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}
@ -213,8 +212,8 @@ impl<D: Decoder> Decodable<D> for () {
}
impl<S: Encoder, T> Encodable<S> for PhantomData<T> {
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
Ok(())
}
}