From 165e6c903ef40a958dae6ff59bf2d50085f349b9 Mon Sep 17 00:00:00 2001
From: Sam Scott <sam@osohq.com>
Date: Wed, 3 Jun 2020 10:29:01 -0400
Subject: Revert to rustfmt defaults.

---
 examples/csv_vectors.rs   |  13 ++---
 rustfmt.toml              |   6 ---
 src/actix.rs              |  10 ++--
 src/de/mod.rs             | 117 ++++++++++++++---------------------------
 src/de/parse.rs           | 130 +++++++++++++++++++++-------------------------
 src/ser.rs                |  64 +++++------------------
 tests/test_actix.rs       |  16 +++---
 tests/test_deserialize.rs |  18 +++----
 8 files changed, 129 insertions(+), 245 deletions(-)
 delete mode 100644 rustfmt.toml

diff --git a/examples/csv_vectors.rs b/examples/csv_vectors.rs
index 4dbc947..c193c64 100644
--- a/examples/csv_vectors.rs
+++ b/examples/csv_vectors.rs
@@ -41,10 +41,7 @@ impl<T: DeserializeOwned> Default for CSVVecVisitor<T> {
 impl<'de, T: DeserializeOwned> serde::de::Visitor<'de> for CSVVecVisitor<T> {
     type Value = Vec<T>;
 
-    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")
     }
 
@@ -55,12 +52,8 @@ impl<'de, T: DeserializeOwned> serde::de::Visitor<'de> for CSVVecVisitor<T> {
         let mut output = Vec::new();
         let mut items = csv::Reader::from_reader(s.as_bytes());
         for res in items.deserialize() {
-            let item: T = res.map_err(|e| {
-                E::custom(format!(
-                    "could not deserialize sequence value: {:?}",
-                    e
-                ))
-            })?;
+            let item: T = res
+                .map_err(|e| E::custom(format!("could not deserialize sequence value: {:?}", e)))?;
             output.push(item);
         }
 
diff --git a/rustfmt.toml b/rustfmt.toml
deleted file mode 100644
index e696b4e..0000000
--- a/rustfmt.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-match_block_trailing_comma = true
-max_width = 80
-newline_style = "Unix"
-reorder_imports = true
-use_try_shorthand = true
-trailing_comma = "Vertical"
diff --git a/src/actix.rs b/src/actix.rs
index 70dc6e1..3c0b0ca 100644
--- a/src/actix.rs
+++ b/src/actix.rs
@@ -6,9 +6,7 @@ use crate::de::Config as QsConfig;
 use crate::error::Error as QsError;
 
 use actix_web::dev::Payload;
-use actix_web::{
-    Error as ActixError, FromRequest, HttpRequest, HttpResponse, ResponseError,
-};
+use actix_web::{Error as ActixError, FromRequest, HttpRequest, HttpResponse, ResponseError};
 use futures::future::{ready, Ready};
 use serde::de;
 use std::fmt;
@@ -97,8 +95,7 @@ where
     fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future {
         let query_config = req.app_data::<QsQueryConfig>();
 
-        let error_handler =
-            query_config.map(|c| c.ehandler.clone()).unwrap_or(None);
+        let error_handler = query_config.map(|c| c.ehandler.clone()).unwrap_or(None);
 
         let default_qsconfig = QsConfig::default();
         let qsconfig = query_config
@@ -157,8 +154,7 @@ where
 /// ```
 
 pub struct QsQueryConfig {
-    ehandler:
-        Option<Arc<dyn Fn(QsError, &HttpRequest) -> ActixError + Send + Sync>>,
+    ehandler: Option<Arc<dyn Fn(QsError, &HttpRequest) -> ActixError + Send + Sync>>,
     qs_config: QsConfig,
 }
 
diff --git a/src/de/mod.rs b/src/de/mod.rs
index 923c4b9..3d8b508 100644
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -108,10 +108,7 @@ impl Config {
 
 impl Config {
     /// Deserializes a querystring from a `&[u8]` using this `Config`.
-    pub fn deserialize_bytes<'de, T: de::Deserialize<'de>>(
-        &self,
-        input: &'de [u8],
-    ) -> Result<T> {
+    pub fn deserialize_bytes<'de, T: de::Deserialize<'de>>(&self, input: &'de [u8]) -> Result<T> {
         T::deserialize(QsDeserializer::with_config(self, input)?)
     }
 
@@ -125,10 +122,7 @@ impl Config {
     // }
 
     /// Deserializes a querystring from a `&str` using this `Config`.
-    pub fn deserialize_str<'de, T: de::Deserialize<'de>>(
-        &self,
-        input: &'de str,
-    ) -> Result<T> {
+    pub fn deserialize_str<'de, T: de::Deserialize<'de>>(&self, input: &'de str) -> Result<T> {
         self.deserialize_bytes(input.as_bytes())
     }
 }
@@ -220,8 +214,7 @@ impl<'a> QsDeserializer<'a> {
 
     /// Returns a new `QsDeserializer<'a>`.
     fn with_config(config: &Config, input: &'a [u8]) -> Result<Self> {
-        parse::Parser::new(input, config.max_depth(), config.strict)
-            .as_deserializer()
+        parse::Parser::new(input, config.max_depth(), config.strict).as_deserializer()
     }
 }
 
@@ -264,11 +257,7 @@ impl<'de> de::Deserializer<'de> for QsDeserializer<'de> {
         Err(Error::top_level("sequence"))
     }
 
-    fn deserialize_newtype_struct<V>(
-        self,
-        _name: &'static str,
-        visitor: V,
-    ) -> Result<V::Value>
+    fn deserialize_newtype_struct<V>(self, _name: &'static str, visitor: V) -> Result<V::Value>
     where
         V: de::Visitor<'de>,
     {
@@ -409,11 +398,7 @@ impl<'de> de::VariantAccess<'de> for QsDeserializer<'de> {
             Err(de::Error::custom("no value to deserialize"))
         }
     }
-    fn struct_variant<V>(
-        self,
-        _fields: &'static [&'static str],
-        visitor: V,
-    ) -> Result<V::Value>
+    fn struct_variant<V>(self, _fields: &'static [&'static str], visitor: V) -> Result<V::Value>
     where
         V: de::Visitor<'de>,
     {
@@ -468,11 +453,7 @@ impl<'de> de::VariantAccess<'de> for LevelDeserializer<'de> {
     {
         de::Deserializer::deserialize_seq(self, visitor)
     }
-    fn struct_variant<V>(
-        self,
-        _fields: &'static [&'static str],
-        visitor: V,
-    ) -> Result<V::Value>
+    fn struct_variant<V>(self, _fields: &'static [&'static str], visitor: V) -> Result<V::Value>
     where
         V: de::Visitor<'de>,
     {
@@ -482,9 +463,7 @@ impl<'de> de::VariantAccess<'de> for LevelDeserializer<'de> {
 
 struct LevelSeq<'a, I: Iterator<Item = Level<'a>>>(I);
 
-impl<'de, I: Iterator<Item = Level<'de>>> de::SeqAccess<'de>
-    for LevelSeq<'de, I>
-{
+impl<'de, I: Iterator<Item = Level<'de>>> de::SeqAccess<'de> for LevelSeq<'de, I> {
     type Error = Error;
     fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>>
     where
@@ -501,35 +480,32 @@ impl<'de, I: Iterator<Item = Level<'de>>> de::SeqAccess<'de>
 struct LevelDeserializer<'a>(Level<'a>);
 
 macro_rules! deserialize_primitive {
-    ($ty:ident, $method:ident, $visit_method:ident) => (
+    ($ty:ident, $method:ident, $visit_method:ident) => {
         fn $method<V>(self, visitor: V) -> Result<V::Value>
-            where V: de::Visitor<'de>,
+        where
+            V: de::Visitor<'de>,
         {
             match self.0 {
-                Level::Nested(_) => {
-                    Err(de::Error::custom(format!("Expected: {:?}, got a Map",
-                                                  stringify!($ty))))
-                },
-                Level::OrderedSeq(_) => {
-                    Err(de::Error::custom(format!("Expected: {:?}, got an OrderedSequence",
-                                                  stringify!($ty))))
-                },
-                Level::Sequence(_) => {
-                    Err(de::Error::custom(format!("Expected: {:?}, got a Sequence",
-                                                  stringify!($ty))))
-                },
-                Level::Flat(x) => {
-                    ParsableStringDeserializer(x).$method(visitor)
-                },
-                Level::Invalid(e) => {
-                    Err(de::Error::custom(e))
-                },
-                Level::Uninitialised => {
-                    Err(de::Error::custom("attempted to deserialize unitialised value"))
-                },
+                Level::Nested(_) => Err(de::Error::custom(format!(
+                    "Expected: {:?}, got a Map",
+                    stringify!($ty)
+                ))),
+                Level::OrderedSeq(_) => Err(de::Error::custom(format!(
+                    "Expected: {:?}, got an OrderedSequence",
+                    stringify!($ty)
+                ))),
+                Level::Sequence(_) => Err(de::Error::custom(format!(
+                    "Expected: {:?}, got a Sequence",
+                    stringify!($ty)
+                ))),
+                Level::Flat(x) => ParsableStringDeserializer(x).$method(visitor),
+                Level::Invalid(e) => Err(de::Error::custom(e)),
+                Level::Uninitialised => Err(de::Error::custom(
+                    "attempted to deserialize unitialised value",
+                )),
             }
         }
-    )
+    };
 }
 
 impl<'a> LevelDeserializer<'a> {
@@ -554,15 +530,9 @@ impl<'de> de::Deserializer<'de> for LevelDeserializer<'de> {
         V: de::Visitor<'de>,
     {
         match self.0 {
-            Level::Nested(_) => {
-                self.into_deserializer()?.deserialize_map(visitor)
-            },
-            Level::OrderedSeq(map) => {
-                visitor.visit_seq(LevelSeq(map.into_iter().map(|(_k, v)| v)))
-            },
-            Level::Sequence(seq) => {
-                visitor.visit_seq(LevelSeq(seq.into_iter()))
-            },
+            Level::Nested(_) => self.into_deserializer()?.deserialize_map(visitor),
+            Level::OrderedSeq(map) => visitor.visit_seq(LevelSeq(map.into_iter().map(|(_k, v)| v))),
+            Level::Sequence(seq) => visitor.visit_seq(LevelSeq(seq.into_iter())),
             Level::Flat(x) => match x {
                 Cow::Owned(s) => visitor.visit_string(s),
                 Cow::Borrowed(s) => visitor.visit_borrowed_str(s),
@@ -595,8 +565,9 @@ impl<'de> de::Deserializer<'de> for LevelDeserializer<'de> {
         V: de::Visitor<'de>,
     {
         match self.0 {
-            Level::Nested(map) => QsDeserializer::with_map(map)
-                .deserialize_enum(name, variants, visitor),
+            Level::Nested(map) => {
+                QsDeserializer::with_map(map).deserialize_enum(name, variants, visitor)
+            }
             Level::Flat(_) => visitor.visit_enum(self),
             x => Err(de::Error::custom(format!(
                 "{:?} does not appear to be \
@@ -606,29 +577,19 @@ impl<'de> de::Deserializer<'de> for LevelDeserializer<'de> {
         }
     }
 
-    fn deserialize_newtype_struct<V>(
-        self,
-        _name: &'static str,
-        visitor: V,
-    ) -> Result<V::Value>
+    fn deserialize_newtype_struct<V>(self, _name: &'static str, visitor: V) -> Result<V::Value>
     where
         V: de::Visitor<'de>,
     {
         match self.0 {
-            Level::Nested(_) => {
-                self.into_deserializer()?.deserialize_map(visitor)
-            },
-            Level::OrderedSeq(map) => {
-                visitor.visit_seq(LevelSeq(map.into_iter().map(|(_k, v)| v)))
-            },
-            Level::Sequence(seq) => {
-                visitor.visit_seq(LevelSeq(seq.into_iter()))
-            },
+            Level::Nested(_) => self.into_deserializer()?.deserialize_map(visitor),
+            Level::OrderedSeq(map) => visitor.visit_seq(LevelSeq(map.into_iter().map(|(_k, v)| v))),
+            Level::Sequence(seq) => visitor.visit_seq(LevelSeq(seq.into_iter())),
             Level::Flat(_) => {
                 // For a newtype_struct, attempt to deserialize a flat value as a
                 // single element sequence.
                 visitor.visit_seq(LevelSeq(vec![self.0].into_iter()))
-            },
+            }
             Level::Invalid(e) => Err(de::Error::custom(e)),
             Level::Uninitialised => Err(de::Error::custom(
                 "attempted to deserialize unitialised \
diff --git a/src/de/parse.rs b/src/de/parse.rs
index c23aa7e..ffd1a3f 100644
--- a/src/de/parse.rs
+++ b/src/de/parse.rs
@@ -11,11 +11,7 @@ macro_rules! tu {
     ($x:expr) => {
         match $x {
             Some(x) => *x,
-            None => {
-                return Err(de::Error::custom(
-                    "query string ended before expected",
-                ))
-            },
+            None => return Err(de::Error::custom("query string ended before expected")),
         }
     };
 }
@@ -30,13 +26,12 @@ impl<'a> Level<'a> {
             match map.entry(key) {
                 Entry::Occupied(mut o) => {
                     // Throw away old result; map is now invalid anyway.
-                    let _ =
-                        o.insert(Level::Invalid("Multiple values for one key"));
-                },
+                    let _ = o.insert(Level::Invalid("Multiple values for one key"));
+                }
                 Entry::Vacant(vm) => {
                     // Map is empty, result is None
                     let _ = vm.insert(Level::Flat(value));
-                },
+                }
             }
         } else if let Level::Uninitialised = *self {
             let mut map = BTreeMap::default();
@@ -56,13 +51,12 @@ impl<'a> Level<'a> {
             match map.entry(key) {
                 Entry::Occupied(mut o) => {
                     // Throw away old result; map is now invalid anyway.
-                    let _ =
-                        o.insert(Level::Invalid("Multiple values for one key"));
-                },
+                    let _ = o.insert(Level::Invalid("Multiple values for one key"));
+                }
                 Entry::Vacant(vm) => {
                     // Map is empty, result is None
                     let _ = vm.insert(Level::Flat(value));
-                },
+                }
             }
         } else if let Level::Uninitialised = *self {
             // To reach here, self is either an OrderedSeq or nothing.
@@ -147,21 +141,21 @@ impl<'a> Iterator for Parser<'a> {
                                     let _ = self.iter.next();
                                     self.index += 2;
                                     Some(&b'[')
-                                },
+                                }
                                 b"5D" => {
                                     // skip the next two characters
                                     let _ = self.iter.next();
                                     let _ = self.iter.next();
                                     self.index += 2;
                                     Some(&b']')
-                                },
+                                }
                                 _ => Some(v),
                             }
-                        },
+                        }
                         Some(v) => Some(v),
                         None => None,
                     }
-                },
+                }
             }
         } else {
             match self.peeked.take() {
@@ -170,7 +164,7 @@ impl<'a> Iterator for Parser<'a> {
                     self.index += 1;
                     self.acc.1 += 1;
                     self.iter.next()
-                },
+                }
             }
         }
     }
@@ -205,7 +199,7 @@ fn replace_plus(input: &[u8]) -> Cow<[u8]> {
             }
 
             Cow::Owned(replaced)
-        },
+        }
     }
 }
 
@@ -241,17 +235,15 @@ impl<'a> Parser<'a> {
                         Cow::Borrowed(_) => {
                             // In this case, neither method made replacements, so we
                             // reuse the original bytes
-                            let res = str::from_utf8(
-                                &self.inner[self.acc.0..self.acc.1 - 1],
-                            )?;
+                            let res = str::from_utf8(&self.inner[self.acc.0..self.acc.1 - 1])?;
                             Ok(Cow::Borrowed(res))
-                        },
+                        }
                         Cow::Owned(owned) => {
                             let res = String::from_utf8(owned)?;
                             Ok(Cow::Owned(res))
-                        },
+                        }
                     }
-                },
+                }
                 Cow::Owned(owned) => Ok(Cow::Owned(owned)),
             };
         self.clear_acc();
@@ -302,7 +294,7 @@ impl<'a> Parser<'a> {
                                     } else {
                                         let _ = self.next();
                                     }
-                                },
+                                }
                                 // key is simply "[]", so treat as a seq.
                                 b']' => {
                                     // throw away the bracket
@@ -310,24 +302,21 @@ impl<'a> Parser<'a> {
                                     self.clear_acc();
                                     self.parse_seq_value(node)?;
                                     return Ok(true);
-                                },
+                                }
                                 // First character is an integer, attempt to parse it as an integer key
                                 b'0'..=b'9' => {
                                     let key = self.parse_key(b']', true)?;
-                                    let key = usize::from_str_radix(&key, 10)
-                                        .map_err(Error::from)?;
+                                    let key =
+                                        usize::from_str_radix(&key, 10).map_err(Error::from)?;
                                     self.parse_ord_seq_value(key, node)?;
                                     return Ok(true);
-                                },
+                                }
                                 // Key is "[a..=" so parse up to the closing "]"
-                                0x20..=0x2f
-                                | 0x3a..=0x5a
-                                | 0x5c
-                                | 0x5e..=0x7e => {
+                                0x20..=0x2f | 0x3a..=0x5a | 0x5c | 0x5e..=0x7e => {
                                     let key = self.parse_key(b']', true)?;
                                     self.parse_map_value(key, node)?;
                                     return Ok(true);
-                                },
+                                }
                                 c => {
                                     if self.strict {
                                         return Err(super::Error::parse_err(
@@ -340,10 +329,10 @@ impl<'a> Parser<'a> {
                                     } else {
                                         let _ = self.next();
                                     }
-                                },
+                                }
                             }
                         }
-                    },
+                    }
                     // This means the key should be a root key
                     // of the form "abc" or "abc[..=]"
                     // We do actually allow integer keys here since they cannot
@@ -353,9 +342,9 @@ impl<'a> Parser<'a> {
                         // Root keys are _always_ map values
                         self.parse_map_value(key, node)?;
                         Ok(true)
-                    },
+                    }
                 }
-            },
+            }
             // Ran out of characters to parse
             None => Ok(false),
         }
@@ -381,7 +370,7 @@ impl<'a> Parser<'a> {
                             self.peeked = Some(x);
                         }
                         return self.collect_str();
-                    },
+                    }
                     b'=' => {
                         // Allow the '=' byte only when parsing keys within []
                         if end_on != b']' {
@@ -392,17 +381,17 @@ impl<'a> Parser<'a> {
                         }
 
                         // otherwise do nothing, so '=' is accumulated
-                    },
+                    }
                     b'&' => {
                         // important to keep the `&` character so we know the
                         // key-value is of the form `key&..=` (i.e. no value)
                         self.peeked = Some(&b'&');
                         return self.collect_str();
-                    },
+                    }
                     _ => {
                         // for any other character
                         // do nothing, keep adding to key
-                    },
+                    }
                 }
             } else {
                 // no more string to parse
@@ -413,11 +402,7 @@ impl<'a> Parser<'a> {
 
     /// The `(key,value)` pair is determined to be corresponding to a map entry,
     /// so parse it as such. The first part of the `key` has been parsed.
-    fn parse_map_value(
-        &mut self,
-        key: Cow<'a, str>,
-        node: &mut Level<'a>,
-    ) -> Result<()> {
+    fn parse_map_value(&mut self, key: Cow<'a, str>, node: &mut Level<'a>) -> Result<()> {
         self.state = ParsingState::Key;
         let res = loop {
             if let Some(x) = self.peek() {
@@ -430,12 +415,12 @@ impl<'a> Parser<'a> {
                         let value: Cow<'a, str> = self.collect_str()?;
                         node.insert_map_value(key, value);
                         break Ok(());
-                    },
+                    }
                     b'&' => {
                         // No value
                         node.insert_map_value(key, Cow::Borrowed(""));
                         break Ok(());
-                    },
+                    }
                     b'[' => {
                         // The key continues to another level of nested.
                         // Add a new unitialised level for this node and continue.
@@ -448,9 +433,7 @@ impl<'a> Parser<'a> {
                             // Either take the existing entry, or add a new
                             // unitialised level
                             // Use this new node to keep parsing
-                            let _ = self.parse(
-                                map.entry(key).or_insert(Level::Uninitialised),
-                            )?;
+                            let _ = self.parse(map.entry(key).or_insert(Level::Uninitialised))?;
                             break Ok(());
                         } else {
                             // We expected to parse into a map here.
@@ -463,16 +446,22 @@ impl<'a> Parser<'a> {
                                 self.index,
                             ));
                         }
-                    },
+                    }
                     c => {
                         // Anything else is unexpected since we just finished
                         // parsing a key.
                         if self.strict {
-                            break Err(super::Error::parse_err(format!("Unexpected character: '{}' found when parsing", String::from_utf8_lossy(&[c])), self.index));
+                            break Err(super::Error::parse_err(
+                                format!(
+                                    "Unexpected character: '{}' found when parsing",
+                                    String::from_utf8_lossy(&[c])
+                                ),
+                                self.index,
+                            ));
                         } else {
                             let _ = self.next();
                         }
-                    },
+                    }
                 }
             } else {
                 // The string has ended, so the value is empty.
@@ -489,11 +478,7 @@ impl<'a> Parser<'a> {
     /// ordered sequence.
     /// Basically the same as the above, but we insert into `OrderedSeq`
     /// Can potentially be merged?
-    fn parse_ord_seq_value(
-        &mut self,
-        key: usize,
-        node: &mut Level<'a>,
-    ) -> Result<()> {
+    fn parse_ord_seq_value(&mut self, key: usize, node: &mut Level<'a>) -> Result<()> {
         self.state = ParsingState::Key;
         let res = loop {
             if let Some(x) = self.peek() {
@@ -507,12 +492,12 @@ impl<'a> Parser<'a> {
                         // Reached the end of the key string
                         node.insert_ord_seq_value(key, value);
                         break Ok(());
-                    },
+                    }
                     b'&' => {
                         // No value
                         node.insert_ord_seq_value(key, Cow::Borrowed(""));
                         break Ok(());
-                    },
+                    }
                     b'[' => {
                         // The key continues to another level of nested.
                         // Add a new unitialised level for this node and continue.
@@ -540,18 +525,19 @@ impl<'a> Parser<'a> {
                                 self.index,
                             ));
                         }
-                    },
+                    }
                     c => {
                         // Anything else is unexpected since we just finished
                         // parsing a key.
                         if self.strict {
-                            break Err(super::Error::parse_err(format!("Unexpected character: {:?} found when parsing",
-                                                                      c),
-                                                              self.index));
+                            break Err(super::Error::parse_err(
+                                format!("Unexpected character: {:?} found when parsing", c),
+                                self.index,
+                            ));
                         } else {
                             let _ = self.next();
                         }
-                    },
+                    }
                 }
             } else {
                 // The string has ended, so the value is empty.
@@ -580,24 +566,24 @@ impl<'a> Parser<'a> {
                         let value = self.collect_str()?;
                         node.insert_seq_value(value);
                         Ok(())
-                    },
+                    }
                     b'&' => {
                         // key value is empty
                         node.insert_seq_value(Cow::Borrowed(""));
                         Ok(())
-                    },
+                    }
                     _ => Err(super::Error::parse_err(
                         "non-indexed sequence of \
                          structs not supported",
                         self.index,
                     )),
                 }
-            },
+            }
             None => {
                 // The string has ended, so the value is empty.
                 node.insert_seq_value(Cow::Borrowed(""));
                 Ok(())
-            },
+            }
         };
         // We have finished parsing this level, so go back up a level.
         self.depth += 1;
diff --git a/src/ser.rs b/src/ser.rs
index 618b148..c34343d 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -82,10 +82,7 @@ pub fn to_string<T: ser::Serialize>(input: &T) -> Result<String> {
 ///     "name=Alice&age=24&occupation=Student");
 /// # }
 /// ```
-pub fn to_writer<T: ser::Serialize, W: Write>(
-    input: &T,
-    writer: &mut W,
-) -> Result<()> {
+pub fn to_writer<T: ser::Serialize, W: Write>(input: &T, writer: &mut W) -> Result<()> {
     let mut first = true;
     input.serialize(&mut QsSerializer {
         writer,
@@ -119,19 +116,15 @@ fn replace_space(input: &str) -> Cow<str> {
                     *byte = b'+';
                 }
             }
-            Cow::Owned(
-                String::from_utf8(replaced)
-                    .expect("replacing ' ' with '+' cannot panic"),
-            )
-        },
+            Cow::Owned(String::from_utf8(replaced).expect("replacing ' ' with '+' cannot panic"))
+        }
     }
 }
 
 impl<'a, W: 'a + Write> QsSerializer<'a, W> {
     fn extend_key(&mut self, newkey: &str) {
         let newkey =
-            percent_encode(replace_space(newkey).as_bytes(), QS_ENCODE_SET)
-                .collect::<Cow<str>>();
+            percent_encode(replace_space(newkey).as_bytes(), QS_ENCODE_SET).collect::<Cow<str>>();
         let key = if let Some(ref key) = self.key {
             format!("{}[{}]", key, newkey).into()
         } else {
@@ -164,9 +157,7 @@ impl<'a, W: 'a + Write> QsSerializer<'a, W> {
 
     /// Creates a new `QsSerializer` with a distinct key, but `writer` and
     ///`first` referring to the original data.
-    fn new_from_ref<'b: 'a>(
-        other: &'a mut QsSerializer<'b, W>,
-    ) -> QsSerializer<'a, W> {
+    fn new_from_ref<'b: 'a>(other: &'a mut QsSerializer<'b, W>) -> QsSerializer<'a, W> {
         Self {
             key: other.key.clone(),
             writer: other.writer,
@@ -275,10 +266,7 @@ impl<'a, W: Write> ser::Serializer for &'a mut QsSerializer<'a, W> {
         Ok(())
     }
 
-    fn serialize_some<T: ?Sized + ser::Serialize>(
-        self,
-        value: &T,
-    ) -> Result<Self::Ok> {
+    fn serialize_some<T: ?Sized + ser::Serialize>(self, value: &T) -> Result<Self::Ok> {
         // Err(ErrorKind::Unsupported.into())
         value.serialize(self)
     }
@@ -317,11 +305,7 @@ impl<'a, W: Write> ser::Serializer for &'a mut QsSerializer<'a, W> {
         Ok(QsMap(self, None))
     }
 
-    fn serialize_struct(
-        self,
-        _name: &'static str,
-        _len: usize,
-    ) -> Result<Self::SerializeStruct> {
+    fn serialize_struct(self, _name: &'static str, _len: usize) -> Result<Self::SerializeStruct> {
         Ok(self)
     }
 
@@ -347,10 +331,7 @@ impl ser::Error for Error {
 }
 
 pub struct QsSeq<'a, W: 'a + Write>(&'a mut QsSerializer<'a, W>, usize);
-pub struct QsMap<'a, W: 'a + Write>(
-    &'a mut QsSerializer<'a, W>,
-    Option<Cow<'a, str>>,
-);
+pub struct QsMap<'a, W: 'a + Write>(&'a mut QsSerializer<'a, W>, Option<Cow<'a, str>>);
 
 impl<'a, W: Write> ser::SerializeTuple for QsSeq<'a, W> {
     type Ok = ();
@@ -390,11 +371,7 @@ impl<'a, W: Write> ser::SerializeSeq for QsSeq<'a, W> {
 impl<'a, W: Write> ser::SerializeStruct for &'a mut QsSerializer<'a, W> {
     type Ok = ();
     type Error = Error;
-    fn serialize_field<T: ?Sized>(
-        &mut self,
-        key: &'static str,
-        value: &T,
-    ) -> Result<()>
+    fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<()>
     where
         T: ser::Serialize,
     {
@@ -411,11 +388,7 @@ impl<'a, W: Write> ser::SerializeStructVariant for &'a mut QsSerializer<'a, W> {
     type Ok = ();
     type Error = Error;
 
-    fn serialize_field<T: ?Sized>(
-        &mut self,
-        key: &'static str,
-        value: &T,
-    ) -> Result<()>
+    fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<()>
     where
         T: ser::Serialize,
     {
@@ -497,11 +470,7 @@ impl<'a, W: Write> ser::SerializeMap for QsMap<'a, W> {
         Ok(())
     }
 
-    fn serialize_entry<K: ?Sized, V: ?Sized>(
-        &mut self,
-        key: &K,
-        value: &V,
-    ) -> Result<()>
+    fn serialize_entry<K: ?Sized, V: ?Sized>(&mut self, key: &K, value: &V) -> Result<()>
     where
         K: ser::Serialize,
         V: ser::Serialize,
@@ -591,10 +560,7 @@ impl ser::Serializer for StringSerializer {
     }
 
     /// Returns an error.
-    fn serialize_some<T: ?Sized + ser::Serialize>(
-        self,
-        _value: &T,
-    ) -> Result<Self::Ok> {
+    fn serialize_some<T: ?Sized + ser::Serialize>(self, _value: &T) -> Result<Self::Ok> {
         Err(ErrorKind::Unsupported.into())
     }
 
@@ -630,11 +596,7 @@ impl ser::Serializer for StringSerializer {
         Err(ErrorKind::Unsupported.into())
     }
 
-    fn serialize_struct(
-        self,
-        _name: &'static str,
-        _len: usize,
-    ) -> Result<Self::SerializeStruct> {
+    fn serialize_struct(self, _name: &'static str, _len: usize) -> Result<Self::SerializeStruct> {
         Err(ErrorKind::Unsupported.into())
     }
 
diff --git a/tests/test_actix.rs b/tests/test_actix.rs
index 34969d4..062cf0c 100644
--- a/tests/test_actix.rs
+++ b/tests/test_actix.rs
@@ -105,10 +105,9 @@ fn test_composite_querystring_extractor() {
 #[test]
 fn test_default_qs_config() {
     futures::executor::block_on(async {
-        let req = TestRequest::with_uri(
-            "/test?foo=1&bars%5B%5D=3&limit=100&offset=50&remaining=true",
-        )
-        .to_srv_request();
+        let req =
+            TestRequest::with_uri("/test?foo=1&bars%5B%5D=3&limit=100&offset=50&remaining=true")
+                .to_srv_request();
         let (req, mut pl) = req.into_parts();
 
         let e = QsQuery::<Query>::from_request(&req, &mut pl)
@@ -124,11 +123,10 @@ fn test_default_qs_config() {
 #[test]
 fn test_custom_qs_config() {
     futures::executor::block_on(async {
-        let req = TestRequest::with_uri(
-            "/test?foo=1&bars%5B%5D=3&limit=100&offset=50&remaining=true",
-        )
-        .app_data(QsQueryConfig::default().qs_config(QsConfig::new(5, false)))
-        .to_srv_request();
+        let req =
+            TestRequest::with_uri("/test?foo=1&bars%5B%5D=3&limit=100&offset=50&remaining=true")
+                .app_data(QsQueryConfig::default().qs_config(QsConfig::new(5, false)))
+                .to_srv_request();
 
         let (req, mut pl) = req.into_parts();
 
diff --git a/tests/test_deserialize.rs b/tests/test_deserialize.rs
index 4e02823..213a3fa 100644
--- a/tests/test_deserialize.rs
+++ b/tests/test_deserialize.rs
@@ -455,15 +455,13 @@ fn strict_mode() {
 
     let strict_config = qs::Config::default();
 
-    let params: Result<Query, _> =
-        strict_config.deserialize_str("vec%5B0%5D%5Ba%5D=1&vec[1][a]=2");
+    let params: Result<Query, _> = strict_config.deserialize_str("vec%5B0%5D%5Ba%5D=1&vec[1][a]=2");
     assert!(params.is_err());
     println!("{}", params.unwrap_err());
 
     let loose_config = qs::Config::new(5, false);
 
-    let params: Result<Query, _> =
-        loose_config.deserialize_str("vec%5B0%5D%5Ba%5D=1&vec[1][a]=2");
+    let params: Result<Query, _> = loose_config.deserialize_str("vec%5B0%5D%5Ba%5D=1&vec[1][a]=2");
     assert_eq!(
         params.unwrap(),
         Query {
@@ -480,8 +478,7 @@ fn strict_mode() {
         }
     );
 
-    let params: Result<Query, _> =
-        loose_config.deserialize_str("vec[%5B0%5D%5Ba%5D=1&vec[1][a]=2");
+    let params: Result<Query, _> = loose_config.deserialize_str("vec[%5B0%5D%5Ba%5D=1&vec[1][a]=2");
     assert_eq!(
         params.unwrap(),
         Query {
@@ -489,8 +486,7 @@ fn strict_mode() {
         }
     );
 
-    let params: Result<Query, _> =
-        loose_config.deserialize_str("vec%5B0%5D%5Ba%5D]=1&vec[1][a]=2");
+    let params: Result<Query, _> = loose_config.deserialize_str("vec%5B0%5D%5Ba%5D]=1&vec[1][a]=2");
     assert_eq!(
         params.unwrap(),
         Query {
@@ -507,13 +503,11 @@ fn strict_mode() {
     let params = OddTest { a: 12 };
     let enc_params = qs::to_string(&params).unwrap();
     println!("Encoded as: {}", enc_params);
-    let rec_params: Result<OddTest, _> =
-        strict_config.deserialize_str(&enc_params);
+    let rec_params: Result<OddTest, _> = strict_config.deserialize_str(&enc_params);
     assert_eq!(rec_params.unwrap(), params);
 
     // Non-strict decoding cannot necessarily handle these weird scenerios.
-    let rec_params: Result<OddTest, _> =
-        loose_config.deserialize_str(&enc_params);
+    let rec_params: Result<OddTest, _> = loose_config.deserialize_str(&enc_params);
     assert!(rec_params.is_err());
     println!("{}", rec_params.unwrap_err());
 
-- 
cgit v1.2.3