Skip to content

Commit fae01ad

Browse files
committed
Merge pull request #28 from tshakah/master
Remove old closure kind syntax
2 parents 2dbc11d + d85ca75 commit fae01ad

7 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ mod tests {
461461

462462
#[test]
463463
fn test_datetime_parse_from_str() {
464-
let ymdhms = |&: y,m,d,h,n,s,off| FixedOffset::east(off).ymd(y,m,d).and_hms(h,n,s);
464+
let ymdhms = |y,m,d,h,n,s,off| FixedOffset::east(off).ymd(y,m,d).and_hms(h,n,s);
465465
assert_eq!(DateTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
466466
Ok(ymdhms(2014, 5, 7, 12, 34, 56, 570*60))); // ignore offset
467467
assert!(DateTime::parse_from_str("20140507000000", "%Y%m%d%H%M%S").is_err()); // no offset

src/format/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ pub fn format<'a, I>(w: &mut fmt::Formatter, date: Option<&NaiveDate>, time: Opt
259259
use self::Numeric::*;
260260

261261
let week_from_sun =
262-
|&: d: &NaiveDate| (d.ordinal() - d.weekday().num_days_from_sunday() + 7) / 7;
262+
|d: &NaiveDate| (d.ordinal() - d.weekday().num_days_from_sunday() + 7) / 7;
263263
let week_from_mon =
264-
|&: d: &NaiveDate| (d.ordinal() - d.weekday().num_days_from_monday() + 7) / 7;
264+
|d: &NaiveDate| (d.ordinal() - d.weekday().num_days_from_monday() + 7) / 7;
265265

266266
let (width, v) = match spec {
267267
Year => (4, date.map(|d| d.year() as i64)),

src/format/strftime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl<'a> Iterator for StrftimeItems<'a> {
216216
// the next item is space
217217
Some((c, _)) if c.is_whitespace() => {
218218
// `%` is not a whitespace, so `c != '%'` is redundant
219-
let nextspec = self.remainder.find(|&: c: char| !c.is_whitespace())
219+
let nextspec = self.remainder.find(|c: char| !c.is_whitespace())
220220
.unwrap_or(self.remainder.len());
221221
assert!(nextspec > 0);
222222
let item = sp!(&self.remainder[..nextspec]);
@@ -226,7 +226,7 @@ impl<'a> Iterator for StrftimeItems<'a> {
226226

227227
// the next item is literal
228228
_ => {
229-
let nextspec = self.remainder.find(|&: c: char| c.is_whitespace() || c == '%')
229+
let nextspec = self.remainder.find(|c: char| c.is_whitespace() || c == '%')
230230
.unwrap_or(self.remainder.len());
231231
assert!(nextspec > 0);
232232
let item = lit!(&self.remainder[..nextspec]);

src/naive/date.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ mod tests {
536536

537537
#[test]
538538
fn test_date_from_ymd() {
539-
let ymd_opt = |&: y,m,d| NaiveDate::from_ymd_opt(y, m, d);
539+
let ymd_opt = |y,m,d| NaiveDate::from_ymd_opt(y, m, d);
540540

541541
assert!(ymd_opt(2012, 0, 1).is_none());
542542
assert!(ymd_opt(2012, 1, 1).is_some());
@@ -552,8 +552,8 @@ mod tests {
552552

553553
#[test]
554554
fn test_date_from_yo() {
555-
let yo_opt = |&: y,o| NaiveDate::from_yo_opt(y, o);
556-
let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d);
555+
let yo_opt = |y,o| NaiveDate::from_yo_opt(y, o);
556+
let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
557557

558558
assert_eq!(yo_opt(2012, 0), None);
559559
assert_eq!(yo_opt(2012, 1), Some(ymd(2012, 1, 1)));
@@ -582,8 +582,8 @@ mod tests {
582582

583583
#[test]
584584
fn test_date_from_isoywd() {
585-
let isoywd_opt = |&: y,w,d| NaiveDate::from_isoywd_opt(y, w, d);
586-
let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d);
585+
let isoywd_opt = |y,w,d| NaiveDate::from_isoywd_opt(y, w, d);
586+
let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
587587

588588
assert_eq!(isoywd_opt(2004, 0, Weekday::Sun), None);
589589
assert_eq!(isoywd_opt(2004, 1, Weekday::Mon), Some(ymd(2003, 12, 29)));
@@ -645,7 +645,7 @@ mod tests {
645645

646646
#[test]
647647
fn test_date_from_num_days_from_ce() {
648-
let from_ndays_from_ce = |&: days| NaiveDate::from_num_days_from_ce_opt(days);
648+
let from_ndays_from_ce = |days| NaiveDate::from_num_days_from_ce_opt(days);
649649
assert_eq!(from_ndays_from_ce(1), Some(NaiveDate::from_ymd(1, 1, 1)));
650650
assert_eq!(from_ndays_from_ce(2), Some(NaiveDate::from_ymd(1, 1, 2)));
651651
assert_eq!(from_ndays_from_ce(31), Some(NaiveDate::from_ymd(1, 1, 31)));
@@ -772,7 +772,7 @@ mod tests {
772772

773773
#[test]
774774
fn test_date_succ() {
775-
let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d);
775+
let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
776776
assert_eq!(ymd(2014, 5, 6).succ_opt(), Some(ymd(2014, 5, 7)));
777777
assert_eq!(ymd(2014, 5, 31).succ_opt(), Some(ymd(2014, 6, 1)));
778778
assert_eq!(ymd(2014, 12, 31).succ_opt(), Some(ymd(2015, 1, 1)));
@@ -782,7 +782,7 @@ mod tests {
782782

783783
#[test]
784784
fn test_date_pred() {
785-
let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d);
785+
let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
786786
assert_eq!(ymd(2016, 3, 1).pred_opt(), Some(ymd(2016, 2, 29)));
787787
assert_eq!(ymd(2015, 1, 1).pred_opt(), Some(ymd(2014, 12, 31)));
788788
assert_eq!(ymd(2014, 6, 1).pred_opt(), Some(ymd(2014, 5, 31)));
@@ -903,7 +903,7 @@ mod tests {
903903

904904
#[test]
905905
fn test_date_parse_from_str() {
906-
let ymd = |&: y,m,d| NaiveDate::from_ymd(y,m,d);
906+
let ymd = |y,m,d| NaiveDate::from_ymd(y,m,d);
907907
assert_eq!(NaiveDate::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
908908
Ok(ymd(2014, 5, 7))); // ignore time and offset
909909
assert_eq!(NaiveDate::parse_from_str("2015-W06-1=2015-033", "%G-W%V-%u = %Y-%j"),

src/naive/datetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ mod tests {
372372

373373
#[test]
374374
fn test_datetime_sub() {
375-
let ymdhms = |&: y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
375+
let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
376376
assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) - ymdhms(2014, 5, 6, 7, 8, 9), Duration::zero());
377377
assert_eq!(ymdhms(2014, 5, 6, 7, 8, 10) - ymdhms(2014, 5, 6, 7, 8, 9),
378378
Duration::seconds(1));
@@ -434,7 +434,7 @@ mod tests {
434434

435435
#[test]
436436
fn test_datetime_parse_from_str() {
437-
let ymdhms = |&: y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
437+
let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
438438
assert_eq!(NaiveDateTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
439439
Ok(ymdhms(2014, 5, 7, 12, 34, 56))); // ignore offset
440440
assert_eq!(NaiveDateTime::parse_from_str("2015-W06-1 000000", "%G-W%V-%u%H%M%S"),

src/naive/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ mod tests {
355355
//assert_eq!(rhs + lhs, sum);
356356
}
357357

358-
let hmsm = |&: h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi);
358+
let hmsm = |h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi);
359359

360360
check(hmsm(3, 5, 7, 900), Duration::zero(), hmsm(3, 5, 7, 900));
361361
check(hmsm(3, 5, 7, 900), Duration::milliseconds(100), hmsm(3, 5, 8, 0));
@@ -373,7 +373,7 @@ mod tests {
373373
assert_eq!(rhs - lhs, -diff);
374374
}
375375

376-
let hmsm = |&: h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi);
376+
let hmsm = |h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi);
377377

378378
check(hmsm(3, 5, 7, 900), hmsm(3, 5, 7, 900), Duration::zero());
379379
check(hmsm(3, 5, 7, 900), hmsm(3, 5, 7, 600), Duration::milliseconds(300));
@@ -448,7 +448,7 @@ mod tests {
448448

449449
#[test]
450450
fn test_time_parse_from_str() {
451-
let hms = |&: h,m,s| NaiveTime::from_hms(h,m,s);
451+
let hms = |h,m,s| NaiveTime::from_hms(h,m,s);
452452
assert_eq!(NaiveTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
453453
Ok(hms(12, 34, 56))); // ignore date and offset
454454
assert_eq!(NaiveTime::parse_from_str("PM 12:59", "%P %H:%M"),

src/offset/local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ impl TimeZone for Local {
8080

8181
// they are easier to define in terms of the finished date and time unlike other offsets
8282
fn offset_from_local_date(&self, local: &NaiveDate) -> LocalResult<FixedOffset> {
83-
self.from_local_date(local).map(|&: date| *date.offset())
83+
self.from_local_date(local).map(|date| *date.offset())
8484
}
8585
fn offset_from_local_datetime(&self, local: &NaiveDateTime) -> LocalResult<FixedOffset> {
86-
self.from_local_datetime(local).map(|&: datetime| *datetime.offset())
86+
self.from_local_datetime(local).map(|datetime| *datetime.offset())
8787
}
8888

8989
fn offset_from_utc_date(&self, utc: &NaiveDate) -> FixedOffset {

0 commit comments

Comments
 (0)