mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 15:26:12 +00:00
Move doc comments from method to trait (for consistency)
This commit is contained in:
parent
483da3b834
commit
78230395a6
@ -1865,9 +1865,6 @@ impl AddAssign<OldDuration> for NaiveDate {
|
||||
}
|
||||
}
|
||||
|
||||
impl Add<Months> for NaiveDate {
|
||||
type Output = NaiveDate;
|
||||
|
||||
/// An addition of months to `NaiveDate` clamped to valid days in resulting month.
|
||||
///
|
||||
/// # Panics
|
||||
@ -1888,14 +1885,14 @@ impl Add<Months> for NaiveDate {
|
||||
/// assert_eq!(from_ymd(2014, 1, 31) + Months::new(1), from_ymd(2014, 2, 28));
|
||||
/// assert_eq!(from_ymd(2020, 1, 31) + Months::new(1), from_ymd(2020, 2, 29));
|
||||
/// ```
|
||||
impl Add<Months> for NaiveDate {
|
||||
type Output = NaiveDate;
|
||||
|
||||
fn add(self, months: Months) -> Self::Output {
|
||||
self.checked_add_months(months).expect("`NaiveDate + Months` out of range")
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub<Months> for NaiveDate {
|
||||
type Output = NaiveDate;
|
||||
|
||||
/// A subtraction of Months from `NaiveDate` clamped to valid days in resulting month.
|
||||
///
|
||||
/// # Panics
|
||||
@ -1913,6 +1910,9 @@ impl Sub<Months> for NaiveDate {
|
||||
/// assert_eq!(from_ymd(2014, 1, 1) - Months::new(12), from_ymd(2013, 1, 1));
|
||||
/// assert_eq!(from_ymd(2014, 1, 1) - Months::new(13), from_ymd(2012, 12, 1));
|
||||
/// ```
|
||||
impl Sub<Months> for NaiveDate {
|
||||
type Output = NaiveDate;
|
||||
|
||||
fn sub(self, months: Months) -> Self::Output {
|
||||
self.checked_sub_months(months).expect("`NaiveDate - Months` out of range")
|
||||
}
|
||||
|
@ -1628,9 +1628,6 @@ impl Add<FixedOffset> for NaiveDateTime {
|
||||
}
|
||||
}
|
||||
|
||||
impl Add<Months> for NaiveDateTime {
|
||||
type Output = NaiveDateTime;
|
||||
|
||||
/// An addition of months to `NaiveDateTime` clamped to valid days in resulting month.
|
||||
///
|
||||
/// # Panics
|
||||
@ -1667,6 +1664,9 @@ impl Add<Months> for NaiveDateTime {
|
||||
/// NaiveDate::from_ymd_opt(2020, 2, 29).unwrap().and_hms_opt(6, 0, 0).unwrap()
|
||||
/// );
|
||||
/// ```
|
||||
impl Add<Months> for NaiveDateTime {
|
||||
type Output = NaiveDateTime;
|
||||
|
||||
fn add(self, rhs: Months) -> Self::Output {
|
||||
self.checked_add_months(rhs).expect("`NaiveDateTime + Months` out of range")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user