aboutsummaryrefslogtreecommitdiff
path: root/src/de.rs
diff options
context:
space:
mode:
authorDaniel Lockyer <thisisdaniellockyer@gmail.com>2017-03-30 12:40:27 +0100
committerDaniel Lockyer <thisisdaniellockyer@gmail.com>2017-04-12 09:28:56 +0100
commita2053c850515a0d9f45cd0a3cec9acc555117e87 (patch)
treebf61e65c9ca2eaaeb50da47f4726881f38422401 /src/de.rs
parent635e742488c076fb646efb86e182ffa9ff8fe73d (diff)
downloadmilf-rs-a2053c850515a0d9f45cd0a3cec9acc555117e87.tar.gz
milf-rs-a2053c850515a0d9f45cd0a3cec9acc555117e87.zip
Simplify if-statements
Diffstat (limited to 'src/de.rs')
-rw-r--r--src/de.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/de.rs b/src/de.rs
index 0888186..0022791 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -687,7 +687,7 @@ impl<'a> Deserializer<'a> {
}
fn number_or_date(&mut self, s: &'a str) -> Result<Value<'a>, Error> {
- if s.contains("T") || (s.len() > 1 && s[1..].contains("-")) &&
+ if s.contains('T') || (s.len() > 1 && s[1..].contains('-')) &&
!s.contains("e-") {
self.datetime(s, false).map(Value::Datetime)
} else if self.eat(Token::Colon)? {
@@ -698,7 +698,7 @@ impl<'a> Deserializer<'a> {
}
fn number(&mut self, s: &'a str) -> Result<Value<'a>, Error> {
- if s.contains("e") || s.contains("E") {
+ if s.contains('e') || s.contains('E') {
self.float(s, None).map(Value::Float)
} else if self.eat(Token::Period)? {
let at = self.tokens.current();
@@ -727,7 +727,7 @@ impl<'a> Deserializer<'a> {
if suffix != "" {
return Err(self.error(start, ErrorKind::NumberInvalid))
}
- prefix.replace("_", "").trim_left_matches("+").parse().map_err(|_e| {
+ prefix.replace("_", "").trim_left_matches('+').parse().map_err(|_e| {
self.error(start, ErrorKind::NumberInvalid)
})
}
@@ -789,7 +789,7 @@ impl<'a> Deserializer<'a> {
}
let mut exponent = None;
- if suffix.starts_with("e") || suffix.starts_with("E") {
+ if suffix.starts_with('e') || suffix.starts_with('E') {
let (a, b) = if suffix.len() == 1 {
self.eat(Token::Plus)?;
match self.next()? {
@@ -807,7 +807,7 @@ impl<'a> Deserializer<'a> {
exponent = Some(a);
}
- let mut number = integral.trim_left_matches("+")
+ let mut number = integral.trim_left_matches('+')
.chars()
.filter(|c| *c != '_')
.collect::<String>();