From bccdce1a3ac0dc0646f4ffa9bc0a09ea19ae58a5 Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Sun, 12 Mar 2017 14:44:44 -0400 Subject: Run rustfmt on code. --- src/ser/key.rs | 30 ++++++++++++------------------ src/ser/mod.rs | 13 ++++++++----- src/ser/part.rs | 16 ++++++++++------ src/ser/value.rs | 11 +++++------ 4 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src/ser') diff --git a/src/ser/key.rs b/src/ser/key.rs index 5b2ccdd..10f1fff 100644 --- a/src/ser/key.rs +++ b/src/ser/key.rs @@ -1,7 +1,7 @@ -use ser::{Error}; -use serde::ser::{SerializeSeq, SerializeStruct}; +use ser::Error; use ser::part::Sink; use serde::Serialize; +use serde::ser::{SerializeSeq, SerializeStruct}; use std::borrow::Cow; use std::ops::Deref; @@ -35,7 +35,7 @@ pub struct KeySink { } impl KeySink - where End: for<'key> FnOnce(Key<'key>) -> Result + where End: for<'key> FnOnce(Key<'key>) -> Result, { pub fn new(end: End) -> Self { KeySink { end: end } @@ -43,12 +43,9 @@ impl KeySink } impl Sink for KeySink - where End: for<'key> FnOnce(Key<'key>) -> Result + where End: for<'key> FnOnce(Key<'key>) -> Result, { - - fn serialize_static_str(self, - value: &'static str) - -> Result { + fn serialize_static_str(self, value: &'static str) -> Result { (self.end)(Key::Static(value)) } @@ -76,15 +73,15 @@ impl Sink for KeySink } impl SerializeStruct for KeySink -where End: for<'key> FnOnce(Key<'key>) -> Result + where End: for<'key> FnOnce(Key<'key>) -> Result, { type Ok = Ok; type Error = Error; fn serialize_field(&mut self, - _key: &'static str, - _value: &T) - -> Result<(), Error> { + _key: &'static str, + _value: &T) + -> Result<(), Error> { Err(self.unsupported()) } @@ -94,14 +91,14 @@ where End: for<'key> FnOnce(Key<'key>) -> Result } impl SerializeSeq for KeySink -where End: for<'key> FnOnce(Key<'key>) -> Result + where End: for<'key> FnOnce(Key<'key>) -> Result, { type Ok = Ok; type Error = Error; fn serialize_element(&mut self, - _value: &T) - -> Result<(), Error> { + _value: &T) + -> Result<(), Error> { Err(self.unsupported()) } @@ -109,6 +106,3 @@ where End: for<'key> FnOnce(Key<'key>) -> Result Err(self.unsupported()) } } - - - diff --git a/src/ser/mod.rs b/src/ser/mod.rs index f732bb3..67ed046 100644 --- a/src/ser/mod.rs +++ b/src/ser/mod.rs @@ -22,14 +22,14 @@ use url::form_urlencoded::Target as UrlEncodedTarget; /// struct Query { /// name: String, /// age: u8, -/// occupation: String, +/// occupation: String, /// } /// /// # fn main(){ /// let q = Query { /// name: "Alice".to_owned(), /// age: 24, -/// occupation: "Student".to_owned(), +/// occupation: "Student".to_owned(), /// }; /// /// @@ -389,7 +389,8 @@ impl<'output, Target> ser::SerializeTuple for TupleSerializer<'output, Target> } impl<'output, Target> ser::SerializeTupleStruct - for TupleStructSerializer<'output, Target> + for + TupleStructSerializer<'output, Target> where Target: 'output + UrlEncodedTarget, { type Ok = &'output mut UrlEncodedSerializer; @@ -407,7 +408,8 @@ impl<'output, Target> ser::SerializeTupleStruct } impl<'output, Target> ser::SerializeTupleVariant - for TupleVariantSerializer<'output, Target> + for + TupleVariantSerializer<'output, Target> where Target: 'output + UrlEncodedTarget, { type Ok = &'output mut UrlEncodedSerializer; @@ -491,7 +493,8 @@ impl<'output, Target> ser::SerializeStruct for StructSerializer<'output, Target> } impl<'output, Target> ser::SerializeStructVariant - for StructVariantSerializer<'output, Target> + for + StructVariantSerializer<'output, Target> where Target: 'output + UrlEncodedTarget, { type Ok = &'output mut UrlEncodedSerializer; diff --git a/src/ser/part.rs b/src/ser/part.rs index 4cf90b3..949af61 100644 --- a/src/ser/part.rs +++ b/src/ser/part.rs @@ -1,10 +1,10 @@ use dtoa; use itoa; use ser::Error; -use serde::ser; use serde; -use std::str; +use serde::ser; use std::marker::PhantomData; +use std::str; pub struct PartSerializer> { sink: S, @@ -13,15 +13,19 @@ pub struct PartSerializer> { impl> PartSerializer { pub fn new(sink: S) -> Self { - PartSerializer { sink: sink, marker: PhantomData } + PartSerializer { + sink: sink, + marker: PhantomData, + } } } -pub trait Sink: Sized + ser::SerializeStruct + ser::SerializeSeq +pub trait Sink: Sized + ser::SerializeStruct + + ser::SerializeSeq where E: serde::ser::Error { - // type Ok; - // type Error; +// type Ok; +// type Error; fn serialize_static_str(self, value: &'static str) -> Result; diff --git a/src/ser/value.rs b/src/ser/value.rs index 5ed80b9..f2fc617 100644 --- a/src/ser/value.rs +++ b/src/ser/value.rs @@ -68,9 +68,9 @@ impl<'key, 'target, Target> SerializeStruct for ValueSink<'key, 'target, Target> type Error = Error; fn serialize_field(&mut self, - key: &'static str, - value: &T) - -> Result<(), Error> { + key: &'static str, + value: &T) + -> Result<(), Error> { let newk = format!("{}[{}]", self.key, key); let value_sink = ValueSink::new(self.urlencoder, &newk); value.serialize(super::part::PartSerializer::new(value_sink)) @@ -88,8 +88,8 @@ impl<'key, 'target, Target> SerializeSeq for ValueSink<'key, 'target, Target> type Error = Error; fn serialize_element(&mut self, - value: &T) - -> Result<(), Error> { + value: &T) + -> Result<(), Error> { let newk = format!("{}[{}]", self.key, self.idx); self.idx += 1; let value_sink = ValueSink::new(self.urlencoder, &newk); @@ -100,4 +100,3 @@ impl<'key, 'target, Target> SerializeSeq for ValueSink<'key, 'target, Target> Ok(()) } } - -- cgit v1.2.3