Skip to content

Commit 7381ea0

Browse files
committed
Remove emit_unit
It doesn't do anything for all encoders
1 parent 22e8d5f commit 7381ea0

File tree

8 files changed

+12
-33
lines changed

8 files changed

+12
-33
lines changed

compiler/rustc_ast/src/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2473,8 +2473,8 @@ rustc_index::newtype_index! {
24732473
}
24742474

24752475
impl<S: Encoder> rustc_serialize::Encodable<S> for AttrId {
2476-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
2477-
s.emit_unit()
2476+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
2477+
Ok(())
24782478
}
24792479
}
24802480

compiler/rustc_metadata/src/rmeta/encoder.rs

-5
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ macro_rules! encoder_methods {
9595
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
9696
type Error = <opaque::Encoder as Encoder>::Error;
9797

98-
#[inline]
99-
fn emit_unit(&mut self) -> Result<(), Self::Error> {
100-
Ok(())
101-
}
102-
10398
encoder_methods! {
10499
emit_usize(usize);
105100
emit_u128(u128);

compiler/rustc_middle/src/mir/predecessors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl PredecessorCache {
5656

5757
impl<S: serialize::Encoder> serialize::Encodable<S> for PredecessorCache {
5858
#[inline]
59-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
60-
s.emit_unit()
59+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
60+
Ok(())
6161
}
6262
}
6363

compiler/rustc_middle/src/mir/switch_sources.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl SwitchSourceCache {
5656

5757
impl<S: serialize::Encoder> serialize::Encodable<S> for SwitchSourceCache {
5858
#[inline]
59-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
60-
s.emit_unit()
59+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
60+
Ok(())
6161
}
6262
}
6363

compiler/rustc_middle/src/mir/traversal.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ impl PostorderCache {
367367

368368
impl<S: serialize::Encoder> serialize::Encodable<S> for PostorderCache {
369369
#[inline]
370-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
371-
s.emit_unit()
370+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
371+
Ok(())
372372
}
373373
}
374374

compiler/rustc_query_impl/src/on_disk_cache.rs

-5
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,6 @@ where
993993
{
994994
type Error = E::Error;
995995

996-
#[inline]
997-
fn emit_unit(&mut self) -> Result<(), Self::Error> {
998-
Ok(())
999-
}
1000-
1001996
encoder_methods! {
1002997
emit_usize(usize);
1003998
emit_u128(u128);

compiler/rustc_serialize/src/opaque.rs

-10
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ const STR_SENTINEL: u8 = 0xC1;
6464
impl serialize::Encoder for Encoder {
6565
type Error = !;
6666

67-
#[inline]
68-
fn emit_unit(&mut self) -> EncodeResult {
69-
Ok(())
70-
}
71-
7267
#[inline]
7368
fn emit_usize(&mut self, v: usize) -> EncodeResult {
7469
write_leb128!(self, v, usize, write_usize_leb128)
@@ -419,11 +414,6 @@ macro_rules! file_encoder_write_leb128 {
419414
impl serialize::Encoder for FileEncoder {
420415
type Error = io::Error;
421416

422-
#[inline]
423-
fn emit_unit(&mut self) -> FileEncodeResult {
424-
Ok(())
425-
}
426-
427417
#[inline]
428418
fn emit_usize(&mut self, v: usize) -> FileEncodeResult {
429419
file_encoder_write_leb128!(self, v, usize, write_usize_leb128)

compiler/rustc_serialize/src/serialize.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub trait Encoder {
1515
type Error;
1616

1717
// Primitive types:
18-
fn emit_unit(&mut self) -> Result<(), Self::Error>;
1918
fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>;
2019
fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>;
2120
fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
@@ -203,8 +202,8 @@ impl<D: Decoder> Decodable<D> for String {
203202
}
204203

205204
impl<S: Encoder> Encodable<S> for () {
206-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
207-
s.emit_unit()
205+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
206+
Ok(())
208207
}
209208
}
210209

@@ -213,8 +212,8 @@ impl<D: Decoder> Decodable<D> for () {
213212
}
214213

215214
impl<S: Encoder, T> Encodable<S> for PhantomData<T> {
216-
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
217-
s.emit_unit()
215+
fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
216+
Ok(())
218217
}
219218
}
220219

0 commit comments

Comments
 (0)