@@ -34,15 +34,20 @@ fn pad_zeros(s: String) -> String {
34
34
35
35
if let Some ( cap) = RE_RGX . captures ( & s) {
36
36
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
+ {
38
42
let m_str = mtch. as_str ( ) ;
39
43
if m_str. len ( ) == 1 {
40
44
tm. push ( '0' ) ;
41
45
}
42
46
tm. push_str ( m_str) ;
43
47
tm. push ( ':' ) ;
44
48
}
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)
46
51
47
52
return s. replace ( & cap[ 0 ] , & tm) ;
48
53
}
@@ -57,7 +62,11 @@ fn remove_weekday(s: String) -> String {
57
62
"Wednesday," , "Thursday," , "Friday," , "Saturday," , "Sunday," ,
58
63
] ;
59
64
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)
61
70
}
62
71
63
72
/// Replace long month names with 3 letter Abr as specified in RFC2822.
@@ -81,7 +90,11 @@ fn replace_month(s: String) -> String {
81
90
} ;
82
91
}
83
92
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)
85
98
}
86
99
87
100
/// Convert -0000 to +0000.
@@ -943,7 +956,9 @@ mod tests {
943
956
] ;
944
957
945
958
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
+ } )
947
962
. fold ( ( ) , |( ) , _| ( ) ) ;
948
963
}
949
964
@@ -1513,7 +1528,9 @@ mod tests {
1513
1528
] ;
1514
1529
1515
1530
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
+ } )
1517
1534
. fold ( ( ) , |( ) , _| ( ) ) ;
1518
1535
}
1519
1536
@@ -1795,7 +1812,9 @@ mod tests {
1795
1812
] ;
1796
1813
1797
1814
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
+ } )
1799
1818
. fold ( ( ) , |( ) , _| ( ) ) ;
1800
1819
}
1801
1820
}
0 commit comments