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. --- examples/csv_vectors.rs | 10 +++++----- examples/introduction.rs | 27 +++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'examples') diff --git a/examples/csv_vectors.rs b/examples/csv_vectors.rs index 95e4398..39e95a1 100644 --- a/examples/csv_vectors.rs +++ b/examples/csv_vectors.rs @@ -19,7 +19,7 @@ fn main() { fn from_csv(deserializer: D) -> Result, D::Error> - where D: serde::Deserializer + where D: serde::Deserializer, { deserializer.deserialize_str(CSVVecVisitor) } @@ -30,12 +30,14 @@ struct CSVVecVisitor; impl serde::de::Visitor for CSVVecVisitor { type Value = Vec; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, + formatter: &mut std::fmt::Formatter) + -> std::fmt::Result { write!(formatter, "a str") } fn visit_str(self, s: &str) -> std::result::Result - where E: serde::de::Error + where E: serde::de::Error, { let mut output = Vec::new(); let mut items = csv::Reader::from_string(s); @@ -46,6 +48,4 @@ impl serde::de::Visitor for CSVVecVisitor { Ok(output) } - - } diff --git a/examples/introduction.rs b/examples/introduction.rs index 9d949b4..66283d3 100644 --- a/examples/introduction.rs +++ b/examples/introduction.rs @@ -38,7 +38,7 @@ fn main() { city: "Carrot City".to_string(), postcode: "12345".to_string(), }, - user_ids: vec!(1,2,3,4), + user_ids: vec![1, 2, 3, 4], }; // Naive approach: manually parameters in a map. Painful. @@ -80,19 +80,18 @@ fn main() { let encoded2 = qs::to_string(¶ms).unwrap(); assert_eq!(encoded, encoded2); - // An advantage of `serde_qs` for deserializing, is that it is robust against - // different orderings of inputs: + // An advantage of `serde_qs` for deserializing, is that it is robust + // against different orderings of inputs: - let mut inputs = vec!["id=42", - "name=Acme", - "phone=12345", - "address[city]=Carrot+City", - "address[postcode]=12345", - "user_ids[0]=1", - "user_ids[1]=2", - "user_ids[2]=3", - "user_ids[3]=4" - ]; + let mut inputs = vec!["id=42", + "name=Acme", + "phone=12345", + "address[city]=Carrot+City", + "address[postcode]=12345", + "user_ids[0]=1", + "user_ids[1]=2", + "user_ids[2]=3", + "user_ids[3]=4"]; let mut rng = rand::thread_rng(); for _ in 0..10 { @@ -128,4 +127,4 @@ fn main() { user_ids[512]=4"; let params: QueryParams = qs::from_str(encoded).unwrap(); assert_eq!(params, example_params); -} \ No newline at end of file +} -- cgit v1.2.3