Skip to content

Commit 8aabecb

Browse files
committed
rustfmt-fication.
1 parent 523b1d3 commit 8aabecb

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/lib.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@ fn pad_zeros(s: String) -> String {
3434

3535
if let Some(cap) = RE_RGX.captures(&s) {
3636
let mut tm = String::with_capacity(2 + 1 + 2 + 1 + 2 + 1);
37-
for mtch in cap.iter().skip(1).filter(Option::is_some).map(Option::unwrap) {
37+
for mtch in cap.iter()
38+
.skip(1)
39+
.filter(Option::is_some)
40+
.map(Option::unwrap)
41+
{
3842
let m_str = mtch.as_str();
3943
if m_str.len() == 1 {
4044
tm.push('0');
4145
}
4246
tm.push_str(m_str);
4347
tm.push(':');
4448
}
45-
tm.pop(); // Pop leftover last separator (at no penalty, since we only allocate once either way)
49+
tm.pop(); // Pop leftover last separator (at no penalty, since we only allocate once
50+
// either way)
4651

4752
return s.replace(&cap[0], &tm);
4853
}
@@ -57,7 +62,11 @@ fn remove_weekday(s: String) -> String {
5762
"Wednesday,", "Thursday,", "Friday,", "Saturday,", "Sunday,",
5863
];
5964

60-
WEEKDAYS.iter().find(|&w| s.starts_with(w)).map(|w| s[w.len()..].trim().to_string()).unwrap_or(s)
65+
WEEKDAYS
66+
.iter()
67+
.find(|&w| s.starts_with(w))
68+
.map(|w| s[w.len()..].trim().to_string())
69+
.unwrap_or(s)
6170
}
6271

6372
/// Replace long month names with 3 letter Abr as specified in RFC2822.
@@ -81,7 +90,11 @@ fn replace_month(s: String) -> String {
8190
};
8291
}
8392

84-
MONTHS.iter().find(|&(k, _)| s.contains(k)).map(|(k, v)| s.replace(k, v)).unwrap_or(s)
93+
MONTHS
94+
.iter()
95+
.find(|&(k, _)| s.contains(k))
96+
.map(|(k, v)| s.replace(k, v))
97+
.unwrap_or(s)
8598
}
8699

87100
/// Convert -0000 to +0000.
@@ -943,7 +956,9 @@ mod tests {
943956
];
944957

945958
foo.iter()
946-
.map(|&(bad, good)| assert_eq!(remove_weekday(bad.to_string()), good))
959+
.map(|&(bad, good)| {
960+
assert_eq!(remove_weekday(bad.to_string()), good)
961+
})
947962
.fold((), |(), _| ());
948963
}
949964

@@ -1513,7 +1528,9 @@ mod tests {
15131528
];
15141529

15151530
foo.iter()
1516-
.map(|&(bad, good)| assert_eq!(replace_month(bad.to_string()), good))
1531+
.map(|&(bad, good)| {
1532+
assert_eq!(replace_month(bad.to_string()), good)
1533+
})
15171534
.fold((), |(), _| ());
15181535
}
15191536

@@ -1795,7 +1812,9 @@ mod tests {
17951812
];
17961813

17971814
foo.iter()
1798-
.map(|&(bad, good)| assert_eq!(replace_leading_zeros(bad.to_string()), good))
1815+
.map(|&(bad, good)| {
1816+
assert_eq!(replace_leading_zeros(bad.to_string()), good)
1817+
})
17991818
.fold((), |(), _| ());
18001819
}
18011820
}

0 commit comments

Comments
 (0)