From ddab09459b3395a86c489a2f3e0e460c2feab2b0 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Fri, 16 May 2014 17:04:21 +0900 Subject: [PATCH] language changes: ~"str" -> "str".to_owned(). --- src/chrono/date.rs | 8 ++++---- src/chrono/duration.rs | 17 +++++++++-------- src/chrono/time.rs | 12 +++++++----- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/chrono/date.rs b/src/chrono/date.rs index 050aac2..a9037d6 100644 --- a/src/chrono/date.rs +++ b/src/chrono/date.rs @@ -701,10 +701,10 @@ mod tests { #[test] fn test_date_fmt() { - assert_eq!(DateZ::from_ymd(2012, 3, 4).unwrap().to_str(), ~"2012-03-04"); - assert_eq!(DateZ::from_ymd(0, 3, 4).unwrap().to_str(), ~"0000-03-04"); - assert_eq!(DateZ::from_ymd(-307, 3, 4).unwrap().to_str(), ~"-0307-03-04"); - assert_eq!(DateZ::from_ymd(12345, 3, 4).unwrap().to_str(), ~"+12345-03-04"); + assert_eq!(DateZ::from_ymd(2012, 3, 4).unwrap().to_str(), "2012-03-04".to_owned()); + assert_eq!(DateZ::from_ymd(0, 3, 4).unwrap().to_str(), "0000-03-04".to_owned()); + assert_eq!(DateZ::from_ymd(-307, 3, 4).unwrap().to_str(), "-0307-03-04".to_owned()); + assert_eq!(DateZ::from_ymd(12345, 3, 4).unwrap().to_str(), "+12345-03-04".to_owned()); } } diff --git a/src/chrono/duration.rs b/src/chrono/duration.rs index 55372b8..6096185 100644 --- a/src/chrono/duration.rs +++ b/src/chrono/duration.rs @@ -391,14 +391,15 @@ mod tests { #[test] fn test_duration_fmt() { - assert_eq!(Duration::zero().to_str(), ~"PT0S"); - assert_eq!(Duration::days(42).to_str(), ~"P42D"); - assert_eq!(Duration::days(-42).to_str(), ~"P-42D"); - assert_eq!(Duration::seconds(42).to_str(), ~"PT42S"); - assert_eq!(Duration::milliseconds(42).to_str(), ~"PT0,042S"); - assert_eq!(Duration::microseconds(42).to_str(), ~"PT0,000042S"); - assert_eq!(Duration::nanoseconds(42).to_str(), ~"PT0,000000042S"); - assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_str(), ~"P7DT6,543S"); + assert_eq!(Duration::zero().to_str(), "PT0S".to_owned()); + assert_eq!(Duration::days(42).to_str(), "P42D".to_owned()); + assert_eq!(Duration::days(-42).to_str(), "P-42D".to_owned()); + assert_eq!(Duration::seconds(42).to_str(), "PT42S".to_owned()); + assert_eq!(Duration::milliseconds(42).to_str(), "PT0,042S".to_owned()); + assert_eq!(Duration::microseconds(42).to_str(), "PT0,000042S".to_owned()); + assert_eq!(Duration::nanoseconds(42).to_str(), "PT0,000000042S".to_owned()); + assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_str(), + "P7DT6,543S".to_owned()); } } diff --git a/src/chrono/time.rs b/src/chrono/time.rs index 3235adf..b98bebb 100644 --- a/src/chrono/time.rs +++ b/src/chrono/time.rs @@ -258,11 +258,13 @@ mod tests { #[test] fn test_time_fmt() { - assert_eq!(hmsm(23, 59, 59, 999).to_str(), ~"23:59:59,999"); - assert_eq!(hmsm(23, 59, 59, 1_000).to_str(), ~"23:59:60"); - assert_eq!(hmsm(23, 59, 59, 1_001).to_str(), ~"23:59:60,001"); - assert_eq!(TimeZ::from_hms_micro(0, 0, 0, 43210).unwrap().to_str(), ~"00:00:00,043210"); - assert_eq!(TimeZ::from_hms_nano(0, 0, 0, 6543210).unwrap().to_str(), ~"00:00:00,006543210"); + assert_eq!(hmsm(23, 59, 59, 999).to_str(), "23:59:59,999".to_owned()); + assert_eq!(hmsm(23, 59, 59, 1_000).to_str(), "23:59:60".to_owned()); + assert_eq!(hmsm(23, 59, 59, 1_001).to_str(), "23:59:60,001".to_owned()); + assert_eq!(TimeZ::from_hms_micro(0, 0, 0, 43210).unwrap().to_str(), + "00:00:00,043210".to_owned()); + assert_eq!(TimeZ::from_hms_nano(0, 0, 0, 6543210).unwrap().to_str(), + "00:00:00,006543210".to_owned()); } }