From 897567ecd9f66cd8c7fbb2fda193782c64e666d6 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Sun, 28 May 2023 19:42:42 +0200 Subject: [PATCH] Rename `oldtime` module to `duration` --- src/date.rs | 4 ++-- src/datetime/mod.rs | 2 +- src/datetime/tests.rs | 2 +- src/{oldtime.rs => duration.rs} | 0 src/format/parsed.rs | 2 +- src/lib.rs | 5 ++--- src/naive/date.rs | 4 ++-- src/naive/datetime/mod.rs | 2 +- src/naive/datetime/tests.rs | 2 +- src/naive/time/mod.rs | 2 +- src/naive/time/tests.rs | 2 +- src/offset/fixed.rs | 2 +- src/round.rs | 2 +- 13 files changed, 15 insertions(+), 16 deletions(-) rename src/{oldtime.rs => duration.rs} (100%) diff --git a/src/date.rs b/src/date.rs index 9625556519..3cd511ad5c 100644 --- a/src/date.rs +++ b/src/date.rs @@ -13,13 +13,13 @@ use core::{fmt, hash}; #[cfg(feature = "rkyv")] use rkyv::{Archive, Deserialize, Serialize}; +use crate::duration::Duration as OldDuration; #[cfg(feature = "unstable-locales")] use crate::format::Locale; #[cfg(any(feature = "alloc", feature = "std", test))] use crate::format::{DelayedFormat, Item, StrftimeItems}; use crate::naive::{IsoWeek, NaiveDate, NaiveTime}; use crate::offset::{TimeZone, Utc}; -use crate::oldtime::Duration as OldDuration; use crate::DateTime; use crate::{Datelike, Weekday}; @@ -578,7 +578,7 @@ where mod tests { use super::Date; - use crate::oldtime::Duration; + use crate::duration::Duration; use crate::{FixedOffset, NaiveDate, Utc}; #[cfg(feature = "clock")] diff --git a/src/datetime/mod.rs b/src/datetime/mod.rs index 65a39aa8da..91d637c26c 100644 --- a/src/datetime/mod.rs +++ b/src/datetime/mod.rs @@ -19,6 +19,7 @@ use std::string::ToString; #[cfg(any(feature = "std", test))] use std::time::{SystemTime, UNIX_EPOCH}; +use crate::duration::Duration as OldDuration; #[cfg(any(feature = "alloc", feature = "std", test))] use crate::format::DelayedFormat; #[cfg(feature = "unstable-locales")] @@ -29,7 +30,6 @@ use crate::naive::{Days, IsoWeek, NaiveDate, NaiveDateTime, NaiveTime}; #[cfg(feature = "clock")] use crate::offset::Local; use crate::offset::{FixedOffset, Offset, TimeZone, Utc}; -use crate::oldtime::Duration as OldDuration; #[allow(deprecated)] use crate::Date; use crate::Months; diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs index c6be142d08..5a5db82a27 100644 --- a/src/datetime/tests.rs +++ b/src/datetime/tests.rs @@ -1,11 +1,11 @@ use std::time::{SystemTime, UNIX_EPOCH}; use super::DateTime; +use crate::duration::Duration; use crate::naive::{NaiveDate, NaiveTime}; use crate::offset::{FixedOffset, TimeZone, Utc}; #[cfg(feature = "clock")] use crate::offset::{Local, Offset}; -use crate::oldtime::Duration; use crate::{Datelike, Days, LocalResult, Months, NaiveDateTime}; #[derive(Clone)] diff --git a/src/oldtime.rs b/src/duration.rs similarity index 100% rename from src/oldtime.rs rename to src/duration.rs diff --git a/src/format/parsed.rs b/src/format/parsed.rs index 9526785ee2..203184fecf 100644 --- a/src/format/parsed.rs +++ b/src/format/parsed.rs @@ -5,9 +5,9 @@ //! They can be constructed incrementally while being checked for consistency. use super::{ParseResult, IMPOSSIBLE, NOT_ENOUGH, OUT_OF_RANGE}; +use crate::duration::Duration as OldDuration; use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime}; use crate::offset::{FixedOffset, LocalResult, Offset, TimeZone}; -use crate::oldtime::Duration as OldDuration; use crate::DateTime; use crate::Weekday; use crate::{Datelike, Timelike}; diff --git a/src/lib.rs b/src/lib.rs index d316fba722..f7153b2ee8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -394,9 +394,8 @@ #![cfg_attr(feature = "rustc-serialize", allow(deprecated))] #![cfg_attr(docsrs, feature(doc_cfg))] -mod oldtime; -// this reexport is to aid the transition and should not be in the prelude! -pub use oldtime::{Duration, OutOfRangeError}; +mod duration; +pub use duration::{Duration, OutOfRangeError}; use core::fmt; diff --git a/src/naive/date.rs b/src/naive/date.rs index b9404a15f5..ed7aafda6a 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -15,6 +15,7 @@ use rkyv::{Archive, Deserialize, Serialize}; #[cfg(feature = "unstable-locales")] use pure_rust_locales::Locale; +use crate::duration::Duration as OldDuration; #[cfg(any(feature = "alloc", feature = "std", test))] use crate::format::DelayedFormat; use crate::format::{ @@ -23,7 +24,6 @@ use crate::format::{ }; use crate::month::Months; use crate::naive::{IsoWeek, NaiveDateTime, NaiveTime}; -use crate::oldtime::Duration as OldDuration; use crate::{Datelike, Duration, Weekday}; use super::internals::{self, DateImpl, Mdf, Of, YearFlags}; @@ -2284,7 +2284,7 @@ mod tests { use super::{ Days, Months, NaiveDate, MAX_DAYS_FROM_YEAR_0, MAX_YEAR, MIN_DAYS_FROM_YEAR_0, MIN_YEAR, }; - use crate::oldtime::Duration; + use crate::duration::Duration; use crate::{Datelike, Weekday}; use std::{i32, u32}; diff --git a/src/naive/datetime/mod.rs b/src/naive/datetime/mod.rs index 0a3f70380e..99b089ecf0 100644 --- a/src/naive/datetime/mod.rs +++ b/src/naive/datetime/mod.rs @@ -12,13 +12,13 @@ use core::{fmt, str}; #[cfg(feature = "rkyv")] use rkyv::{Archive, Deserialize, Serialize}; +use crate::duration::Duration as OldDuration; #[cfg(any(feature = "alloc", feature = "std", test))] use crate::format::DelayedFormat; use crate::format::{parse, parse_and_remainder, ParseError, ParseResult, Parsed, StrftimeItems}; use crate::format::{Fixed, Item, Numeric, Pad}; use crate::naive::{Days, IsoWeek, NaiveDate, NaiveTime}; use crate::offset::Utc; -use crate::oldtime::Duration as OldDuration; use crate::{DateTime, Datelike, LocalResult, Months, TimeZone, Timelike, Weekday}; #[cfg(feature = "rustc-serialize")] diff --git a/src/naive/datetime/tests.rs b/src/naive/datetime/tests.rs index 07309a48ac..01e4b60f6c 100644 --- a/src/naive/datetime/tests.rs +++ b/src/naive/datetime/tests.rs @@ -1,5 +1,5 @@ use super::NaiveDateTime; -use crate::oldtime::Duration; +use crate::duration::Duration; use crate::NaiveDate; use crate::{Datelike, FixedOffset, Utc}; use std::i64; diff --git a/src/naive/time/mod.rs b/src/naive/time/mod.rs index 3700c5cba2..4356a14d4e 100644 --- a/src/naive/time/mod.rs +++ b/src/naive/time/mod.rs @@ -11,13 +11,13 @@ use core::{fmt, str}; #[cfg(feature = "rkyv")] use rkyv::{Archive, Deserialize, Serialize}; +use crate::duration::Duration as OldDuration; #[cfg(any(feature = "alloc", feature = "std", test))] use crate::format::DelayedFormat; use crate::format::{ parse, parse_and_remainder, write_hundreds, Fixed, Item, Numeric, Pad, ParseError, ParseResult, Parsed, StrftimeItems, }; -use crate::oldtime::Duration as OldDuration; use crate::Timelike; #[cfg(feature = "rustc-serialize")] diff --git a/src/naive/time/tests.rs b/src/naive/time/tests.rs index 62c46a247e..5bf6abad6d 100644 --- a/src/naive/time/tests.rs +++ b/src/naive/time/tests.rs @@ -1,5 +1,5 @@ use super::NaiveTime; -use crate::oldtime::Duration; +use crate::duration::Duration; use crate::Timelike; use std::u32; diff --git a/src/offset/fixed.rs b/src/offset/fixed.rs index 246d6666ea..bb25ba373e 100644 --- a/src/offset/fixed.rs +++ b/src/offset/fixed.rs @@ -10,8 +10,8 @@ use core::ops::{Add, Sub}; use rkyv::{Archive, Deserialize, Serialize}; use super::{LocalResult, Offset, TimeZone}; +use crate::duration::Duration as OldDuration; use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime}; -use crate::oldtime::Duration as OldDuration; use crate::DateTime; use crate::Timelike; diff --git a/src/round.rs b/src/round.rs index f43ab595c3..a0e9c86fe2 100644 --- a/src/round.rs +++ b/src/round.rs @@ -2,7 +2,7 @@ // See README.md and LICENSE.txt for details. use crate::datetime::DateTime; -use crate::oldtime::Duration; +use crate::duration::Duration; use crate::NaiveDateTime; use crate::TimeZone; use crate::Timelike;