From 0459c5e88e90e297ddb916ab96e62cdfaf7c3414 Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Sun, 10 Jul 2022 15:33:37 -0500 Subject: Formatting. --- src/de/parse.rs | 31 +++++++++++++++---------------- src/lib.rs | 6 +++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/de/parse.rs b/src/de/parse.rs index fe14bb4..20ba962 100644 --- a/src/de/parse.rs +++ b/src/de/parse.rs @@ -250,24 +250,23 @@ impl<'a> Parser<'a> { decoder.decode_utf8_lossy() }; - let ret: Result> = - match maybe_decoded { - Cow::Borrowed(_) => { - match replaced { - 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])?; - Ok(Cow::Borrowed(res)) - } - Cow::Owned(owned) => { - let res = String::from_utf8(owned)?; - Ok(Cow::Owned(res)) - } + let ret: Result> = match maybe_decoded { + Cow::Borrowed(_) => { + match replaced { + 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])?; + Ok(Cow::Borrowed(res)) + } + Cow::Owned(owned) => { + let res = String::from_utf8(owned)?; + Ok(Cow::Owned(res)) } } - Cow::Owned(owned) => Ok(Cow::Owned(owned)), - }; + } + Cow::Owned(owned) => Ok(Cow::Owned(owned)), + }; self.clear_acc(); ret.map_err(Error::from) } diff --git a/src/lib.rs b/src/lib.rs index 9df0f15..27a35c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,7 +81,7 @@ //! - how `serde_qs` handles invalid UTF-8 percent decoded characters //! //! ### Square Brackets -//! +//! //! Technically, square brackets should be encoded in URLs as `%5B` and `%5D`. //! However, they are often used in their raw format to specify querystrings //! such as `a[b]=123`. @@ -101,9 +101,9 @@ //! automatically encodes the brackets. But care must be taken to avoid //! using keys with square brackets in them, or unexpected things can //! happen. -//! +//! //! ### Invalid UTF-8 Percent Encodings -//! +//! //! Sometimes querystrings may have percent-encoded data which does not decode //! to UTF-8. In some cases it is useful for this to cause errors, which is how //! `serde_qs` works in strict mode (the default). Whereas in other cases it -- cgit v1.2.3