summaryrefslogtreecommitdiff
path: root/src/de
diff options
context:
space:
mode:
authorSam Scott <sam.scott89@gmail.com>2020-06-03 10:26:45 -0400
committerGitHub <noreply@github.com>2020-06-03 10:26:45 -0400
commit77cb6730f9265591dad141f4f9b840069c9cd2b9 (patch)
tree6c4cd170f74d0c789e1059a91514d04dc06decba /src/de
parentd5c2d3e44a5cbe2311111fb56bfe6bed8fabd961 (diff)
Support actix-web v2 (#30)
* update dependencies - actix-web v2 - percent encoding v2.1 - rust 2018 edition - remove rustfmt no longer supported rules * ci: add feature build matrix * fix actix unit tests Co-authored-by: Mario Reder <mreder1289@gmail.com>
Diffstat (limited to 'src/de')
-rw-r--r--src/de/mod.rs2
-rw-r--r--src/de/parse.rs40
2 files changed, 21 insertions, 21 deletions
diff --git a/src/de/mod.rs b/src/de/mod.rs
index a82a37b..923c4b9 100644
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -38,7 +38,7 @@
mod parse;
-use error::*;
+use crate::error::*;
use serde::de;
use serde::de::IntoDeserializer;
diff --git a/src/de/parse.rs b/src/de/parse.rs
index 6f10ac3..c23aa7e 100644
--- a/src/de/parse.rs
+++ b/src/de/parse.rs
@@ -1,6 +1,5 @@
use super::*;
-use percent_encoding;
use serde::de;
use std::borrow::Cow;
@@ -206,7 +205,7 @@ fn replace_plus(input: &[u8]) -> Cow<[u8]> {
}
Cow::Owned(replaced)
- }
+ },
}
}
@@ -235,25 +234,26 @@ impl<'a> Parser<'a> {
/// present.
fn collect_str(&mut self) -> Result<Cow<'a, str>> {
let replaced = replace_plus(&self.inner[self.acc.0..self.acc.1 - 1]);
- let ret:Result<Cow<'a, str>> = match percent_encoding::percent_decode(&replaced).decode_utf8()? {
- 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<Cow<'a, str>> =
+ match percent_encoding::percent_decode(&replaced).decode_utf8()? {
+ 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)
}