diff --git a/src/naive/date.rs b/src/naive/date.rs index 7dd0960..85cde84 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -482,7 +482,7 @@ impl NaiveDate { /// ~~~~ #[inline] pub fn and_time(&self, time: NaiveTime) -> NaiveDateTime { - NaiveDateTime::new(self.clone(), time) + NaiveDateTime::new(*self, time) } /// Makes a new `NaiveDateTime` from the current date, hour, minute and second. @@ -884,7 +884,7 @@ impl NaiveDate { #[inline] pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat where I: Iterator> + Clone { - DelayedFormat::new(Some(self.clone()), None, items) + DelayedFormat::new(Some(*self), None, items) } /// Formats the date with the specified format string. diff --git a/src/naive/datetime.rs b/src/naive/datetime.rs index d4a0573..c611f40 100644 --- a/src/naive/datetime.rs +++ b/src/naive/datetime.rs @@ -505,7 +505,7 @@ impl NaiveDateTime { #[inline] pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat where I: Iterator> + Clone { - DelayedFormat::new(Some(self.date.clone()), Some(self.time.clone()), items) + DelayedFormat::new(Some(self.date), Some(self.time), items) } /// Formats the combined date and time with the specified format string. diff --git a/src/naive/time.rs b/src/naive/time.rs index 1082e7f..ec8f564 100644 --- a/src/naive/time.rs +++ b/src/naive/time.rs @@ -652,7 +652,7 @@ impl NaiveTime { #[inline] pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat where I: Iterator> + Clone { - DelayedFormat::new(None, Some(self.clone()), items) + DelayedFormat::new(None, Some(*self), items) } /// Formats the time with the specified format string. diff --git a/src/offset/fixed.rs b/src/offset/fixed.rs index c9471c3..7300427 100644 --- a/src/offset/fixed.rs +++ b/src/offset/fixed.rs @@ -82,17 +82,17 @@ impl FixedOffset { impl TimeZone for FixedOffset { type Offset = FixedOffset; - fn from_offset(offset: &FixedOffset) -> FixedOffset { offset.clone() } + fn from_offset(offset: &FixedOffset) -> FixedOffset { *offset } fn offset_from_local_date(&self, _local: &NaiveDate) -> LocalResult { - LocalResult::Single(self.clone()) + LocalResult::Single(*self) } fn offset_from_local_datetime(&self, _local: &NaiveDateTime) -> LocalResult { - LocalResult::Single(self.clone()) + LocalResult::Single(*self) } - fn offset_from_utc_date(&self, _utc: &NaiveDate) -> FixedOffset { self.clone() } - fn offset_from_utc_datetime(&self, _utc: &NaiveDateTime) -> FixedOffset { self.clone() } + fn offset_from_utc_date(&self, _utc: &NaiveDate) -> FixedOffset { *self } + fn offset_from_utc_datetime(&self, _utc: &NaiveDateTime) -> FixedOffset { *self } } impl Offset for FixedOffset { diff --git a/src/offset/local.rs b/src/offset/local.rs index e31e23d..594b6c9 100644 --- a/src/offset/local.rs +++ b/src/offset/local.rs @@ -111,7 +111,7 @@ impl TimeZone for Local { // in the other words, we use the offset at the local midnight // but keep the actual date unaltered (much like `FixedOffset`). let midnight = self.from_local_datetime(&local.and_hms(0, 0, 0)); - midnight.map(|datetime| Date::from_utc(*local, datetime.offset().clone())) + midnight.map(|datetime| Date::from_utc(*local, *datetime.offset())) } fn from_local_datetime(&self, local: &NaiveDateTime) -> LocalResult> { let timespec = datetime_to_timespec(local, true); @@ -120,7 +120,7 @@ impl TimeZone for Local { fn from_utc_date(&self, utc: &NaiveDate) -> Date { let midnight = self.from_utc_datetime(&utc.and_hms(0, 0, 0)); - Date::from_utc(*utc, midnight.offset().clone()) + Date::from_utc(*utc, *midnight.offset()) } fn from_utc_datetime(&self, utc: &NaiveDateTime) -> DateTime { let timespec = datetime_to_timespec(utc, false); diff --git a/src/offset/mod.rs b/src/offset/mod.rs index 6037a1e..e0a102d 100644 --- a/src/offset/mod.rs +++ b/src/offset/mod.rs @@ -333,13 +333,13 @@ pub trait TimeZone: Sized + Clone { /// Converts the UTC `NaiveDate` to the local time. /// The UTC is continuous and thus this cannot fail (but can give the duplicate local time). fn from_utc_date(&self, utc: &NaiveDate) -> Date { - Date::from_utc(utc.clone(), self.offset_from_utc_date(utc)) + Date::from_utc(*utc, self.offset_from_utc_date(utc)) } /// Converts the UTC `NaiveDateTime` to the local time. /// The UTC is continuous and thus this cannot fail (but can give the duplicate local time). fn from_utc_datetime(&self, utc: &NaiveDateTime) -> DateTime { - DateTime::from_utc(utc.clone(), self.offset_from_utc_datetime(utc)) + DateTime::from_utc(*utc, self.offset_from_utc_datetime(utc)) } }