Fix Clippy lints: if_same_then_else

This commit is contained in:
Brandon W Maister 2017-06-23 15:14:41 -05:00
parent 4a70e160fb
commit 96b31283d0
1 changed files with 10 additions and 15 deletions

View File

@ -230,24 +230,19 @@ pub fn timezone_offset_2822(s: &str) -> ParseResult<(&str, Option<i32>)> {
if upto > 0 {
let name = &s[..upto];
let s = &s[upto..];
let offset_hours = |o| Ok((s, Some(o * 3600)));
if equals(name, "gmt") || equals(name, "ut") {
Ok((s, Some(0)))
} else if equals(name, "est") {
Ok((s, Some(-5 * 3600)))
offset_hours(0)
} else if equals(name, "edt") {
Ok((s, Some(-4 * 3600)))
} else if equals(name, "cst") {
Ok((s, Some(-6 * 3600)))
} else if equals(name, "cdt") {
Ok((s, Some(-5 * 3600)))
} else if equals(name, "mst") {
Ok((s, Some(-7 * 3600)))
} else if equals(name, "mdt") {
Ok((s, Some(-6 * 3600)))
offset_hours(-4)
} else if equals(name, "est") || equals(name, "cdt") {
offset_hours(-5)
} else if equals(name, "cst") || equals(name, "mdt") {
offset_hours(-6)
} else if equals(name, "mst") || equals(name, "pdt") {
offset_hours(-7)
} else if equals(name, "pst") {
Ok((s, Some(-8 * 3600)))
} else if equals(name, "pdt") {
Ok((s, Some(-7 * 3600)))
offset_hours(-8)
} else {
Ok((s, None)) // recommended by RFC 2822: consume but treat it as -0000
}