Skip to content

Commit 69a665f

Browse files
committed
Remove deprecated items in NaiveDate
1 parent 6590e3d commit 69a665f

File tree

2 files changed

+0
-181
lines changed

2 files changed

+0
-181
lines changed

src/naive/date.rs

Lines changed: 0 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,6 @@ pub struct NaiveDate {
199199
ymdf: DateImpl, // (year << 13) | of
200200
}
201201

202-
/// The minimum possible `NaiveDate` (January 1, 262145 BCE).
203-
#[deprecated(since = "0.4.20", note = "Use NaiveDate::MIN instead")]
204-
pub const MIN_DATE: NaiveDate = NaiveDate::MIN;
205-
/// The maximum possible `NaiveDate` (December 31, 262143 CE).
206-
#[deprecated(since = "0.4.20", note = "Use NaiveDate::MAX instead")]
207-
pub const MAX_DATE: NaiveDate = NaiveDate::MAX;
208-
209202
#[cfg(all(feature = "arbitrary", feature = "std"))]
210203
impl arbitrary::Arbitrary<'_> for NaiveDate {
211204
fn arbitrary(u: &mut arbitrary::Unstructured) -> arbitrary::Result<NaiveDate> {
@@ -250,19 +243,6 @@ impl NaiveDate {
250243
}
251244
}
252245

253-
/// Makes a new `NaiveDate` from the [calendar date](#calendar-date)
254-
/// (year, month and day).
255-
///
256-
/// # Panics
257-
///
258-
/// Panics if the specified calendar day does not exist, on invalid values for `month` or `day`,
259-
/// or if `year` is out of range for `NaiveDate`.
260-
#[deprecated(since = "0.4.23", note = "use `from_ymd_opt()` instead")]
261-
#[must_use]
262-
pub const fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate {
263-
expect!(NaiveDate::from_ymd_opt(year, month, day), "invalid or out-of-range date")
264-
}
265-
266246
/// Makes a new `NaiveDate` from the [calendar date](#calendar-date)
267247
/// (year, month and day).
268248
///
@@ -298,19 +278,6 @@ impl NaiveDate {
298278
}
299279
}
300280

301-
/// Makes a new `NaiveDate` from the [ordinal date](#ordinal-date)
302-
/// (year and day of the year).
303-
///
304-
/// # Panics
305-
///
306-
/// Panics if the specified ordinal day does not exist, on invalid values for `ordinal`, or if
307-
/// `year` is out of range for `NaiveDate`.
308-
#[deprecated(since = "0.4.23", note = "use `from_yo_opt()` instead")]
309-
#[must_use]
310-
pub const fn from_yo(year: i32, ordinal: u32) -> NaiveDate {
311-
expect!(NaiveDate::from_yo_opt(year, ordinal), "invalid or out-of-range date")
312-
}
313-
314281
/// Makes a new `NaiveDate` from the [ordinal date](#ordinal-date)
315282
/// (year and day of the year).
316283
///
@@ -342,20 +309,6 @@ impl NaiveDate {
342309
NaiveDate::from_ordinal_and_flags(year, ordinal, flags)
343310
}
344311

345-
/// Makes a new `NaiveDate` from the [ISO week date](#week-date)
346-
/// (year, week number and day of the week).
347-
/// The resulting `NaiveDate` may have a different year from the input year.
348-
///
349-
/// # Panics
350-
///
351-
/// Panics if the specified week does not exist in that year, on invalid values for `week`, or
352-
/// if the resulting date is out of range for `NaiveDate`.
353-
#[deprecated(since = "0.4.23", note = "use `from_isoywd_opt()` instead")]
354-
#[must_use]
355-
pub const fn from_isoywd(year: i32, week: u32, weekday: Weekday) -> NaiveDate {
356-
expect!(NaiveDate::from_isoywd_opt(year, week, weekday), "invalid or out-of-range date")
357-
}
358-
359312
/// Makes a new `NaiveDate` from the [ISO week date](#week-date)
360313
/// (year, week number and day of the week).
361314
/// The resulting `NaiveDate` may have a different year from the input year.
@@ -438,19 +391,6 @@ impl NaiveDate {
438391
}
439392
}
440393

441-
/// Makes a new `NaiveDate` from a day's number in the proleptic Gregorian calendar, with
442-
/// January 1, 1 being day 1.
443-
///
444-
/// # Panics
445-
///
446-
/// Panics if the date is out of range.
447-
#[deprecated(since = "0.4.23", note = "use `from_num_days_from_ce_opt()` instead")]
448-
#[inline]
449-
#[must_use]
450-
pub const fn from_num_days_from_ce(days: i32) -> NaiveDate {
451-
expect!(NaiveDate::from_num_days_from_ce_opt(days), "out-of-range date")
452-
}
453-
454394
/// Makes a new `NaiveDate` from a day's number in the proleptic Gregorian calendar, with
455395
/// January 1, 1 being day 1.
456396
///
@@ -483,27 +423,6 @@ impl NaiveDate {
483423
NaiveDate::from_ordinal_and_flags(year_div_400 * 400 + year_mod_400 as i32, ordinal, flags)
484424
}
485425

486-
/// Makes a new `NaiveDate` by counting the number of occurrences of a particular day-of-week
487-
/// since the beginning of the given month. For instance, if you want the 2nd Friday of March
488-
/// 2017, you would use `NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2)`.
489-
///
490-
/// `n` is 1-indexed.
491-
///
492-
/// # Panics
493-
///
494-
/// Panics if the specified day does not exist in that month, on invalid values for `month` or
495-
/// `n`, or if `year` is out of range for `NaiveDate`.
496-
#[deprecated(since = "0.4.23", note = "use `from_weekday_of_month_opt()` instead")]
497-
#[must_use]
498-
pub const fn from_weekday_of_month(
499-
year: i32,
500-
month: u32,
501-
weekday: Weekday,
502-
n: u8,
503-
) -> NaiveDate {
504-
expect!(NaiveDate::from_weekday_of_month_opt(year, month, weekday, n), "out-of-range date")
505-
}
506-
507426
/// Makes a new `NaiveDate` by counting the number of occurrences of a particular day-of-week
508427
/// since the beginning of the given month. For instance, if you want the 2nd Friday of March
509428
/// 2017, you would use `NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2)`.
@@ -826,21 +745,6 @@ impl NaiveDate {
826745
NaiveDateTime::new(*self, time)
827746
}
828747

829-
/// Makes a new `NaiveDateTime` from the current date, hour, minute and second.
830-
///
831-
/// No [leap second](./struct.NaiveTime.html#leap-second-handling) is allowed here;
832-
/// use `NaiveDate::and_hms_*` methods with a subsecond parameter instead.
833-
///
834-
/// # Panics
835-
///
836-
/// Panics on invalid hour, minute and/or second.
837-
#[deprecated(since = "0.4.23", note = "use `and_hms_opt()` instead")]
838-
#[inline]
839-
#[must_use]
840-
pub const fn and_hms(&self, hour: u32, min: u32, sec: u32) -> NaiveDateTime {
841-
expect!(self.and_hms_opt(hour, min, sec), "invalid time")
842-
}
843-
844748
/// Makes a new `NaiveDateTime` from the current date, hour, minute and second.
845749
///
846750
/// No [leap second](./struct.NaiveTime.html#leap-second-handling) is allowed here;
@@ -868,21 +772,6 @@ impl NaiveDate {
868772
Some(self.and_time(time))
869773
}
870774

871-
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and millisecond.
872-
///
873-
/// The millisecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
874-
/// ./struct.NaiveTime.html#leap-second-handling), but only when `sec == 59`.
875-
///
876-
/// # Panics
877-
///
878-
/// Panics on invalid hour, minute, second and/or millisecond.
879-
#[deprecated(since = "0.4.23", note = "use `and_hms_milli_opt()` instead")]
880-
#[inline]
881-
#[must_use]
882-
pub const fn and_hms_milli(&self, hour: u32, min: u32, sec: u32, milli: u32) -> NaiveDateTime {
883-
expect!(self.and_hms_milli_opt(hour, min, sec, milli), "invalid time")
884-
}
885-
886775
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and millisecond.
887776
///
888777
/// The millisecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
@@ -918,35 +807,6 @@ impl NaiveDate {
918807
Some(self.and_time(time))
919808
}
920809

921-
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and microsecond.
922-
///
923-
/// The microsecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
924-
/// ./struct.NaiveTime.html#leap-second-handling), but only when `sec == 59`.
925-
///
926-
/// # Panics
927-
///
928-
/// Panics on invalid hour, minute, second and/or microsecond.
929-
///
930-
/// # Example
931-
///
932-
/// ```
933-
/// use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
934-
///
935-
/// let d = NaiveDate::from_ymd_opt(2015, 6, 3).unwrap();
936-
///
937-
/// let dt: NaiveDateTime = d.and_hms_micro_opt(12, 34, 56, 789_012).unwrap();
938-
/// assert_eq!(dt.year(), 2015);
939-
/// assert_eq!(dt.weekday(), Weekday::Wed);
940-
/// assert_eq!(dt.second(), 56);
941-
/// assert_eq!(dt.nanosecond(), 789_012_000);
942-
/// ```
943-
#[deprecated(since = "0.4.23", note = "use `and_hms_micro_opt()` instead")]
944-
#[inline]
945-
#[must_use]
946-
pub const fn and_hms_micro(&self, hour: u32, min: u32, sec: u32, micro: u32) -> NaiveDateTime {
947-
expect!(self.and_hms_micro_opt(hour, min, sec, micro), "invalid time")
948-
}
949-
950810
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and microsecond.
951811
///
952812
/// The microsecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
@@ -982,21 +842,6 @@ impl NaiveDate {
982842
Some(self.and_time(time))
983843
}
984844

985-
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and nanosecond.
986-
///
987-
/// The nanosecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
988-
/// ./struct.NaiveTime.html#leap-second-handling), but only when `sec == 59`.
989-
///
990-
/// # Panics
991-
///
992-
/// Panics on invalid hour, minute, second and/or nanosecond.
993-
#[deprecated(since = "0.4.23", note = "use `and_hms_nano_opt()` instead")]
994-
#[inline]
995-
#[must_use]
996-
pub const fn and_hms_nano(&self, hour: u32, min: u32, sec: u32, nano: u32) -> NaiveDateTime {
997-
expect!(self.and_hms_nano_opt(hour, min, sec, nano), "invalid time")
998-
}
999-
1000845
/// Makes a new `NaiveDateTime` from the current date, hour, minute, second and nanosecond.
1001846
///
1002847
/// The nanosecond part is allowed to exceed 1,000,000,000 in order to represent a [leap second](
@@ -1061,18 +906,6 @@ impl NaiveDate {
1061906
NaiveDate { ymdf: (self.ymdf & !0b1_1111_1111_1111) | of.inner() as DateImpl }
1062907
}
1063908

1064-
/// Makes a new `NaiveDate` for the next calendar date.
1065-
///
1066-
/// # Panics
1067-
///
1068-
/// Panics when `self` is the last representable date.
1069-
#[deprecated(since = "0.4.23", note = "use `succ_opt()` instead")]
1070-
#[inline]
1071-
#[must_use]
1072-
pub const fn succ(&self) -> NaiveDate {
1073-
expect!(self.succ_opt(), "out of bound")
1074-
}
1075-
1076909
/// Makes a new `NaiveDate` for the next calendar date.
1077910
///
1078911
/// # Errors
@@ -1097,18 +930,6 @@ impl NaiveDate {
1097930
}
1098931
}
1099932

1100-
/// Makes a new `NaiveDate` for the previous calendar date.
1101-
///
1102-
/// # Panics
1103-
///
1104-
/// Panics when `self` is the first representable date.
1105-
#[deprecated(since = "0.4.23", note = "use `pred_opt()` instead")]
1106-
#[inline]
1107-
#[must_use]
1108-
pub const fn pred(&self) -> NaiveDate {
1109-
expect!(self.pred_opt(), "out of bound")
1110-
}
1111-
1112933
/// Makes a new `NaiveDate` for the previous calendar date.
1113934
///
1114935
/// # Errors

src/naive/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ pub(crate) mod isoweek;
1111
pub(crate) mod time;
1212

1313
pub use self::date::{Days, NaiveDate, NaiveDateDaysIterator, NaiveDateWeeksIterator, NaiveWeek};
14-
#[allow(deprecated)]
15-
pub use self::date::{MAX_DATE, MIN_DATE};
1614
pub use self::datetime::NaiveDateTime;
1715
pub use self::isoweek::IsoWeek;
1816
pub use self::time::NaiveTime;

0 commit comments

Comments
 (0)