Remove usize and isize from data model

This commit is contained in:
David Tolnay 2017-01-25 08:59:34 -08:00
parent 8cb6607e82
commit e0c049dbf2
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
13 changed files with 76 additions and 150 deletions

View File

@ -180,12 +180,10 @@ macro_rules! impl_deserialize_num {
formatter.write_str(stringify!($ty))
}
impl_deserialize_num_method!($ty, isize, visit_isize, from_isize, Signed, i64);
impl_deserialize_num_method!($ty, i8, visit_i8, from_i8, Signed, i64);
impl_deserialize_num_method!($ty, i16, visit_i16, from_i16, Signed, i64);
impl_deserialize_num_method!($ty, i32, visit_i32, from_i32, Signed, i64);
impl_deserialize_num_method!($ty, i64, visit_i64, from_i64, Signed, i64);
impl_deserialize_num_method!($ty, usize, visit_usize, from_usize, Unsigned, u64);
impl_deserialize_num_method!($ty, u8, visit_u8, from_u8, Unsigned, u64);
impl_deserialize_num_method!($ty, u16, visit_u16, from_u16, Unsigned, u64);
impl_deserialize_num_method!($ty, u32, visit_u32, from_u32, Unsigned, u64);
@ -209,12 +207,12 @@ macro_rules! impl_deserialize_num {
}
}
impl_deserialize_num!(isize, deserialize_isize);
impl_deserialize_num!(isize, deserialize_i64);
impl_deserialize_num!(i8, deserialize_i8);
impl_deserialize_num!(i16, deserialize_i16);
impl_deserialize_num!(i32, deserialize_i32);
impl_deserialize_num!(i64, deserialize_i64);
impl_deserialize_num!(usize, deserialize_usize);
impl_deserialize_num!(usize, deserialize_u64);
impl_deserialize_num!(u8, deserialize_u8);
impl_deserialize_num!(u16, deserialize_u16);
impl_deserialize_num!(u32, deserialize_u32);
@ -1150,7 +1148,7 @@ impl<T, E> Deserialize for Result<T, E> where T: Deserialize, E: Deserialize {
formatter.write_str("`Ok` or `Err`")
}
fn visit_usize<E>(self, value: usize) -> Result<Field, E> where E: Error {
fn visit_u32<E>(self, value: u32) -> Result<Field, E> where E: Error {
match value {
0 => Ok(Field::Ok),
1 => Ok(Field::Err),

View File

@ -339,12 +339,12 @@ pub enum Unexpected<'a> {
/// The input contained a boolean value that was not expected.
Bool(bool),
/// The input contained an unsigned integer `usize`, `u8`, `u16`, `u32` or
/// `u64` that was not expected.
/// The input contained an unsigned integer `u8`, `u16`, `u32` or `u64` that
/// was not expected.
Unsigned(u64),
/// The input contained a signed integer `isize`, `i8`, `i16`, `i32` or
/// `i64` that was not expected.
/// The input contained a signed integer `i8`, `i16`, `i32` or `i64` that
/// was not expected.
Signed(i64),
/// The input contained a floating point `f32` or `f64` that was not
@ -694,7 +694,7 @@ impl<T> DeserializeSeed for PhantomData<T>
/// any data structure supported by Serde.
///
/// The role of this trait is to define the deserialization half of the Serde
/// data model, which is a way to categorize every Rust data type into one of 30
/// data model, which is a way to categorize every Rust data type into one of 28
/// possible types. Each method of the `Serializer` trait corresponds to one of
/// the types of the data model.
///
@ -704,10 +704,10 @@ impl<T> DeserializeSeed for PhantomData<T>
///
/// The types that make up the Serde data model are:
///
/// - 15 primitive types:
/// - 12 primitive types:
/// - bool
/// - isize, i8, i16, i32, i64
/// - usize, u8, u16, u32, u64
/// - i8, i16, i32, i64
/// - u8, u16, u32, u64
/// - f32, f64
/// - char
/// - string
@ -792,10 +792,6 @@ pub trait Deserializer: Sized {
fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
/// Hint that the `Deserialize` type is expecting a `usize` value.
fn deserialize_usize<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
/// Hint that the `Deserialize` type is expecting a `u8` value.
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
@ -812,10 +808,6 @@ pub trait Deserializer: Sized {
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
/// Hint that the `Deserialize` type is expecting an `isize` value.
fn deserialize_isize<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
/// Hint that the `Deserialize` type is expecting an `i8` value.
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor;
@ -1030,13 +1022,6 @@ pub trait Visitor: Sized {
Err(Error::invalid_type(Unexpected::Bool(v), &self))
}
/// Deserialize an `isize` into a `Value`.
fn visit_isize<E>(self, v: isize) -> Result<Self::Value, E>
where E: Error,
{
self.visit_i64(v as i64)
}
/// Deserialize an `i8` into a `Value`.
fn visit_i8<E>(self, v: i8) -> Result<Self::Value, E>
where E: Error,
@ -1065,13 +1050,6 @@ pub trait Visitor: Sized {
Err(Error::invalid_type(Unexpected::Signed(v), &self))
}
/// Deserialize a `usize` into a `Value`.
fn visit_usize<E>(self, v: usize) -> Result<Self::Value, E>
where E: Error,
{
self.visit_u64(v as u64)
}
/// Deserialize a `u8` into a `Value`.
fn visit_u8<E>(self, v: u8) -> Result<Self::Value, E>
where E: Error,

View File

@ -28,10 +28,9 @@ pub fn missing_field<V, E>(field: &'static str) -> Result<V, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str
string unit seq seq_fixed_size bytes byte_buf map unit_struct
newtype_struct tuple_struct struct struct_field tuple enum
ignored_any
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq
seq_fixed_size bytes byte_buf map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any
}
}

View File

@ -126,9 +126,9 @@ impl<E> de::Deserializer for UnitDeserializer<E>
type Error = E;
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq
seq_fixed_size bytes map unit_struct newtype_struct tuple_struct struct
struct_field tuple enum ignored_any byte_buf
}
fn deserialize<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -147,7 +147,7 @@ impl<E> de::Deserializer for UnitDeserializer<E>
///////////////////////////////////////////////////////////////////////////////
macro_rules! primitive_deserializer {
($ty:ty, $name:ident, $method:ident) => {
($ty:ty, $name:ident, $method:ident $($cast:tt)*) => {
/// A helper deserializer that deserializes a number.
pub struct $name<E>($ty, PhantomData<E>);
@ -167,16 +167,15 @@ macro_rules! primitive_deserializer {
type Error = E;
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str
string unit option seq seq_fixed_size bytes map unit_struct
newtype_struct tuple_struct struct struct_field tuple enum
ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit
option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
}
fn deserialize<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where V: de::Visitor,
{
visitor.$method(self.0)
visitor.$method(self.0 $($cast)*)
}
}
}
@ -187,12 +186,12 @@ primitive_deserializer!(i8, I8Deserializer, visit_i8);
primitive_deserializer!(i16, I16Deserializer, visit_i16);
primitive_deserializer!(i32, I32Deserializer, visit_i32);
primitive_deserializer!(i64, I64Deserializer, visit_i64);
primitive_deserializer!(isize, IsizeDeserializer, visit_isize);
primitive_deserializer!(isize, IsizeDeserializer, visit_i64 as i64);
primitive_deserializer!(u8, U8Deserializer, visit_u8);
primitive_deserializer!(u16, U16Deserializer, visit_u16);
primitive_deserializer!(u32, U32Deserializer, visit_u32);
primitive_deserializer!(u64, U64Deserializer, visit_u64);
primitive_deserializer!(usize, UsizeDeserializer, visit_usize);
primitive_deserializer!(usize, UsizeDeserializer, visit_u64 as u64);
primitive_deserializer!(f32, F32Deserializer, visit_f32);
primitive_deserializer!(f64, F64Deserializer, visit_f64);
primitive_deserializer!(char, CharDeserializer, visit_char);
@ -233,9 +232,9 @@ impl<'a, E> de::Deserializer for StrDeserializer<'a, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple ignored_any byte_buf
}
}
@ -291,9 +290,9 @@ impl<E> de::Deserializer for StringDeserializer<E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple ignored_any byte_buf
}
}
@ -353,9 +352,9 @@ impl<'a, E> de::Deserializer for CowStrDeserializer<'a, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple ignored_any byte_buf
}
}
@ -426,9 +425,9 @@ impl<I, T, E> de::Deserializer for SeqDeserializer<I, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple enum ignored_any byte_buf
}
}
@ -538,9 +537,9 @@ impl<V_, E> de::Deserializer for SeqVisitorDeserializer<V_, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple enum ignored_any byte_buf
}
}
@ -634,9 +633,9 @@ impl<I, E> de::Deserializer for MapDeserializer<I, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option bytes map unit_struct newtype_struct tuple_struct struct
struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
bytes map unit_struct newtype_struct tuple_struct struct struct_field
tuple enum ignored_any byte_buf
}
}
@ -728,9 +727,9 @@ impl<A, B, E> de::Deserializer for PairDeserializer<A, B, E>
type Error = E;
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option bytes map unit_struct newtype_struct tuple_struct struct
struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
bytes map unit_struct newtype_struct tuple_struct struct struct_field
tuple enum ignored_any byte_buf
}
fn deserialize<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -872,9 +871,9 @@ impl<V_, E> de::Deserializer for MapVisitorDeserializer<V_, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple enum ignored_any byte_buf
}
}
@ -905,9 +904,9 @@ impl<'a, E> de::Deserializer for BytesDeserializer<'a, E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple enum ignored_any byte_buf
}
}
@ -941,9 +940,9 @@ impl<E> de::Deserializer for ByteBufDeserializer<E>
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any byte_buf
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct
struct struct_field tuple enum ignored_any byte_buf
}
}

View File

@ -32,9 +32,6 @@ macro_rules! forward_to_deserialize_helper {
(bool) => {
forward_to_deserialize_method!{deserialize_bool()}
};
(usize) => {
forward_to_deserialize_method!{deserialize_usize()}
};
(u8) => {
forward_to_deserialize_method!{deserialize_u8()}
};
@ -47,9 +44,6 @@ macro_rules! forward_to_deserialize_helper {
(u64) => {
forward_to_deserialize_method!{deserialize_u64()}
};
(isize) => {
forward_to_deserialize_method!{deserialize_isize()}
};
(i8) => {
forward_to_deserialize_method!{deserialize_i8()}
};
@ -154,9 +148,9 @@ macro_rules! forward_to_deserialize_helper {
/// self.deserialize(visitor)
/// }
/// # forward_to_deserialize! {
/// # usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
/// # unit option seq seq_fixed_size bytes byte_buf map unit_struct
/// # newtype_struct tuple_struct struct struct_field tuple enum ignored_any
/// # u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
/// # seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct
/// # tuple_struct struct struct_field tuple enum ignored_any
/// # }
/// # }
/// # fn main() {}
@ -181,9 +175,9 @@ macro_rules! forward_to_deserialize_helper {
/// }
///
/// forward_to_deserialize! {
/// bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str
/// string unit option seq seq_fixed_size bytes byte_buf map unit_struct
/// newtype_struct tuple_struct struct struct_field tuple enum ignored_any
/// bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option
/// seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct
/// tuple_struct struct struct_field tuple enum ignored_any
/// }
/// }
/// # fn main() {}

View File

@ -74,25 +74,25 @@ use super::Iterator;
///////////////////////////////////////////////////////////////////////////////
macro_rules! impl_visit {
($ty:ty, $method:ident) => {
($ty:ty, $method:ident $($cast:tt)*) => {
impl Serialize for $ty {
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,
{
serializer.$method(*self)
serializer.$method(*self $($cast)*)
}
}
}
}
impl_visit!(bool, serialize_bool);
impl_visit!(isize, serialize_isize);
impl_visit!(isize, serialize_i64 as i64);
impl_visit!(i8, serialize_i8);
impl_visit!(i16, serialize_i16);
impl_visit!(i32, serialize_i32);
impl_visit!(i64, serialize_i64);
impl_visit!(usize, serialize_usize);
impl_visit!(usize, serialize_u64 as u64);
impl_visit!(u8, serialize_u8);
impl_visit!(u16, serialize_u16);
impl_visit!(u32, serialize_u32);

View File

@ -179,7 +179,7 @@ pub trait Serialize {
/// data structure supported by Serde.
///
/// The role of this trait is to define the serialization half of the Serde data
/// model, which is a way to categorize every Rust data structure into one of 30
/// model, which is a way to categorize every Rust data structure into one of 28
/// possible types. Each method of the `Serializer` trait corresponds to one of
/// the types of the data model.
///
@ -188,10 +188,10 @@ pub trait Serialize {
///
/// The types that make up the Serde data model are:
///
/// - 15 primitive types:
/// - 12 primitive types:
/// - bool
/// - isize, i8, i16, i32, i64
/// - usize, u8, u16, u32, u64
/// - i8, i16, i32, i64
/// - u8, u16, u32, u64
/// - f32, f64
/// - char
/// - string
@ -279,13 +279,6 @@ pub trait Serializer {
/// Serialize a `bool` value.
fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error>;
/// Serialize an `isize` value.
///
/// If the format does not differentiate between `isize` and `i64`, a
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
fn serialize_isize(self, v: isize) -> Result<Self::Ok, Self::Error>;
/// Serialize an `i8` value.
///
/// If the format does not differentiate between `i8` and `i64`, a
@ -310,13 +303,6 @@ pub trait Serializer {
/// Serialize an `i64` value.
fn serialize_i64(self, v: i64) -> Result<Self::Ok, Self::Error>;
/// Serialize a `usize` value.
///
/// If the format does not differentiate between `usize` and `u64`, a
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
fn serialize_usize(self, v: usize) -> Result<Self::Ok, Self::Error>;
/// Serialize a `u8` value.
///
/// If the format does not differentiate between `u8` and `u64`, a

View File

@ -692,11 +692,11 @@ fn deserialize_field_visitor(
Some(quote!(__ignore,))
};
let visit_usize = if is_variant {
let variant_indices = 0usize..;
let visit_index = if is_variant {
let variant_indices = 0u32..;
let fallthrough_msg = format!("variant index 0 <= i < {}", fields.len());
Some(quote! {
fn visit_usize<__E>(self, value: usize) -> _serde::export::Result<__Field, __E>
fn visit_u32<__E>(self, value: u32) -> _serde::export::Result<__Field, __E>
where __E: _serde::de::Error
{
match value {
@ -758,7 +758,7 @@ fn deserialize_field_visitor(
formatter.write_str("field name")
}
#visit_usize
#visit_index
fn visit_str<__E>(self, value: &str) -> _serde::export::Result<__Field, __E>
where __E: _serde::de::Error

View File

@ -225,26 +225,16 @@ impl<'a, I> de::Deserializer for &'a mut Deserializer<I>
where __V: de::Visitor {
self.deserialize(visitor)
}
fn deserialize_usize<__V>(self, visitor: __V) -> Result<__V::Value, Self::Error>
where __V: de::Visitor {
self.deserialize(visitor)
}
fn deserialize_isize<__V>(self, visitor: __V) -> Result<__V::Value, Self::Error>
where __V: de::Visitor {
self.deserialize(visitor)
}
fn deserialize<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor,
{
match self.tokens.next() {
Some(Token::Bool(v)) => visitor.visit_bool(v),
Some(Token::Isize(v)) => visitor.visit_isize(v),
Some(Token::I8(v)) => visitor.visit_i8(v),
Some(Token::I16(v)) => visitor.visit_i16(v),
Some(Token::I32(v)) => visitor.visit_i32(v),
Some(Token::I64(v)) => visitor.visit_i64(v),
Some(Token::Usize(v)) => visitor.visit_usize(v),
Some(Token::U8(v)) => visitor.visit_u8(v),
Some(Token::U16(v)) => visitor.visit_u16(v),
Some(Token::U32(v)) => visitor.visit_u32(v),

View File

@ -46,11 +46,6 @@ impl<'s, 'a, I> ser::Serializer for &'s mut Serializer<'a, I>
Ok(())
}
fn serialize_isize(self, v: isize) -> Result<(), Error> {
assert_eq!(self.tokens.next(), Some(&Token::Isize(v)));
Ok(())
}
fn serialize_i8(self, v: i8) -> Result<(), Error> {
assert_eq!(self.tokens.next(), Some(&Token::I8(v)));
Ok(())
@ -71,11 +66,6 @@ impl<'s, 'a, I> ser::Serializer for &'s mut Serializer<'a, I>
Ok(())
}
fn serialize_usize(self, v: usize) -> Result<(), Error> {
assert_eq!(self.tokens.next(), Some(&Token::Usize(v)));
Ok(())
}
fn serialize_u8(self, v: u8) -> Result<(), Error> {
assert_eq!(self.tokens.next(), Some(&Token::U8(v)));
Ok(())

View File

@ -1,12 +1,10 @@
#[derive(Clone, PartialEq, Debug)]
pub enum Token<'a> {
Bool(bool),
Isize(isize),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
Usize(usize),
U8(u8),
U16(u16),
U32(u32),

View File

@ -155,12 +155,10 @@ declare_tests! {
false => &[Token::Bool(false)],
}
test_isize {
0isize => &[Token::Isize(0)],
0isize => &[Token::I8(0)],
0isize => &[Token::I16(0)],
0isize => &[Token::I32(0)],
0isize => &[Token::I64(0)],
0isize => &[Token::Usize(0)],
0isize => &[Token::U8(0)],
0isize => &[Token::U16(0)],
0isize => &[Token::U32(0)],
@ -169,14 +167,12 @@ declare_tests! {
0isize => &[Token::F64(0.)],
}
test_ints {
0isize => &[Token::Isize(0)],
0i8 => &[Token::I8(0)],
0i16 => &[Token::I16(0)],
0i32 => &[Token::I32(0)],
0i64 => &[Token::I64(0)],
}
test_uints {
0usize => &[Token::Usize(0)],
0u8 => &[Token::U8(0)],
0u16 => &[Token::U16(0)],
0u32 => &[Token::U32(0)],
@ -777,7 +773,7 @@ declare_tests! {
test_enum_unit_usize {
Enum::Unit => &[
Token::EnumStart("Enum"),
Token::Usize(0),
Token::U32(0),
Token::Unit,
],
}
@ -935,7 +931,7 @@ declare_error_tests! {
test_enum_out_of_range<Enum> {
&[
Token::EnumStart("Enum"),
Token::Usize(4),
Token::U32(4),
Token::Unit,
],
Error::Message("invalid value: integer `4`, expected variant index 0 <= i < 4".into()),

View File

@ -60,14 +60,12 @@ declare_ser_tests! {
false => &[Token::Bool(false)],
}
test_isizes {
0isize => &[Token::Isize(0)],
0i8 => &[Token::I8(0)],
0i16 => &[Token::I16(0)],
0i32 => &[Token::I32(0)],
0i64 => &[Token::I64(0)],
}
test_usizes {
0usize => &[Token::Usize(0)],
0u8 => &[Token::U8(0)],
0u16 => &[Token::U16(0)],
0u32 => &[Token::U32(0)],