Minor cleanup
This commit is contained in:
parent
5dae700aec
commit
1751155a3a
@ -613,7 +613,10 @@ impl<T, E> Serialize for Result<T, E> where T: Serialize, E: Serialize {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
match *self {
|
||||
Result::Ok(ref field0) => {
|
||||
struct Visitor<'a, T, E> where T: Serialize + 'a, E: Serialize + 'a {
|
||||
struct Visitor<'a, T, E>
|
||||
where T: Serialize + 'a,
|
||||
E: Serialize + 'a
|
||||
{
|
||||
state: usize,
|
||||
value: (&'a T,),
|
||||
_structure_ty: PhantomData<&'a Result<T, E>>,
|
||||
@ -653,7 +656,10 @@ impl<T, E> Serialize for Result<T, E> where T: Serialize, E: Serialize {
|
||||
serializer.visit_enum_seq("Result", 0, "Ok", visitor)
|
||||
}
|
||||
Result::Err(ref field0) => {
|
||||
struct Visitor<'a, T, E> where T: Serialize + 'a, E: Serialize + 'a {
|
||||
struct Visitor<'a, T, E>
|
||||
where T: Serialize + 'a,
|
||||
E: Serialize + 'a
|
||||
{
|
||||
state: usize,
|
||||
value: (&'a E,),
|
||||
_structure_ty: PhantomData<&'a Result<T, E>>,
|
||||
|
@ -21,7 +21,6 @@ pub struct FieldAttrs {
|
||||
}
|
||||
|
||||
impl FieldAttrs {
|
||||
|
||||
/// Create a FieldAttr with a single default field name
|
||||
pub fn new(default_value: bool, name: P<ast::Expr>) -> FieldAttrs {
|
||||
FieldAttrs {
|
||||
@ -35,7 +34,7 @@ impl FieldAttrs {
|
||||
default_value: bool,
|
||||
default_name: P<ast::Expr>,
|
||||
formats: HashMap<P<ast::Expr>, P<ast::Expr>>,
|
||||
) -> FieldAttrs {
|
||||
) -> FieldAttrs {
|
||||
FieldAttrs {
|
||||
names: FieldNames::Format {
|
||||
formats: formats,
|
||||
|
@ -89,7 +89,11 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
name: &str,
|
||||
_variant_index: usize,
|
||||
variant: &str) -> Result<(), ()> {
|
||||
assert_eq!(self.iter.next().unwrap(), Token::EnumUnit(name, variant));
|
||||
assert_eq!(
|
||||
self.iter.next().unwrap(),
|
||||
Token::EnumUnit(name, variant)
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -196,7 +200,10 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
{
|
||||
let len = visitor.len();
|
||||
|
||||
assert_eq!(self.iter.next().unwrap(), Token::TupleStructStart(name, len));
|
||||
assert_eq!(
|
||||
self.iter.next().unwrap(),
|
||||
Token::TupleStructStart(name, len)
|
||||
);
|
||||
|
||||
self.visit_sequence(visitor)
|
||||
}
|
||||
@ -210,7 +217,10 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
{
|
||||
let len = visitor.len();
|
||||
|
||||
assert_eq!(self.iter.next().unwrap(), Token::EnumSeqStart(name, variant, len));
|
||||
assert_eq!(
|
||||
self.iter.next().unwrap(),
|
||||
Token::EnumSeqStart(name, variant, len)
|
||||
);
|
||||
|
||||
self.visit_sequence(visitor)
|
||||
}
|
||||
@ -237,7 +247,10 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
{
|
||||
let len = visitor.len();
|
||||
|
||||
assert_eq!(self.iter.next().unwrap(), Token::StructStart(name, len));
|
||||
assert_eq!(
|
||||
self.iter.next().unwrap(),
|
||||
Token::StructStart(name, len)
|
||||
);
|
||||
|
||||
self.visit_mapping(visitor)
|
||||
}
|
||||
@ -251,7 +264,10 @@ impl<'a> Serializer for AssertSerializer<'a> {
|
||||
{
|
||||
let len = visitor.len();
|
||||
|
||||
assert_eq!(self.iter.next().unwrap(), Token::EnumMapStart(name, variant, len));
|
||||
assert_eq!(
|
||||
self.iter.next().unwrap(),
|
||||
Token::EnumMapStart(name, variant, len)
|
||||
);
|
||||
|
||||
self.visit_mapping(visitor)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user