From 88600a6d7f8f6eb8f85b17b28a17e07eb3a735e5 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 19 Jan 2022 12:09:19 +1100 Subject: Rename `Decoder::read_nil` and `read_unit`. Because `()` is called "unit" and it makes it match `Encoder::emit_unit`. --- compiler/rustc_serialize/src/json.rs | 2 +- compiler/rustc_serialize/src/opaque.rs | 2 +- compiler/rustc_serialize/src/serialize.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_serialize') diff --git a/compiler/rustc_serialize/src/json.rs b/compiler/rustc_serialize/src/json.rs index cb9df3c3389..d3d72ba72a7 100644 --- a/compiler/rustc_serialize/src/json.rs +++ b/compiler/rustc_serialize/src/json.rs @@ -2240,7 +2240,7 @@ macro_rules! read_primitive { impl crate::Decoder for Decoder { type Error = DecoderError; - fn read_nil(&mut self) -> DecodeResult<()> { + fn read_unit(&mut self) -> DecodeResult<()> { expect!(self.pop(), Null) } diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index 078237801be..7e515abbe7b 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -567,7 +567,7 @@ impl<'a> serialize::Decoder for Decoder<'a> { type Error = String; #[inline] - fn read_nil(&mut self) -> Result<(), Self::Error> { + fn read_unit(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs index 96a2231b590..e5104b14724 100644 --- a/compiler/rustc_serialize/src/serialize.rs +++ b/compiler/rustc_serialize/src/serialize.rs @@ -177,7 +177,7 @@ pub trait Decoder { type Error; // Primitive types: - fn read_nil(&mut self) -> Result<(), Self::Error>; + fn read_unit(&mut self) -> Result<(), Self::Error>; fn read_usize(&mut self) -> Result; fn read_u128(&mut self) -> Result; fn read_u64(&mut self) -> Result; @@ -436,7 +436,7 @@ impl Encodable for () { impl Decodable for () { fn decode(d: &mut D) -> Result<(), D::Error> { - d.read_nil() + d.read_unit() } } @@ -448,7 +448,7 @@ impl Encodable for PhantomData { impl Decodable for PhantomData { fn decode(d: &mut D) -> Result, D::Error> { - d.read_nil()?; + d.read_unit()?; Ok(PhantomData) } } -- cgit 1.4.1-3-g733a5