From 6375c8a28dad8c7ec3faec4ead5c30b8192fe1b6 Mon Sep 17 00:00:00 2001 From: Bogdan Kolbik Date: Tue, 17 Oct 2023 11:37:31 +0200 Subject: [PATCH] fix lint --- src/lib.rs | 57 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 77c7d2b..75629cf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -548,19 +548,32 @@ impl TimeWindow { } } - /// Postpones the time window start so that the new duration matches the given value. - /// Is a No-Op if the new duration is smaller than the current one. - /// Negative durations set the result time window size to zero. - /// # Examples + /// Postpones the time window start so that the new duration matches the + /// given value. Is a No-Op if the new duration is smaller than the + /// current one. Negative durations set the result time window size to + /// zero. /// + /// # Examples /// ``` /// # use tinytime::Duration; /// # use tinytime::TimeWindow; /// let x = TimeWindow::from_seconds(1, 3); - /// assert_eq!(TimeWindow::from_seconds(3, 3), x.shrink_towards_end_to(Duration::seconds(-1))); - /// assert_eq!(TimeWindow::from_seconds(3, 3), x.shrink_towards_end_to(Duration::seconds(0))); - /// assert_eq!(TimeWindow::from_seconds(2, 3), x.shrink_towards_end_to(Duration::seconds(1))); - /// assert_eq!(TimeWindow::from_seconds(1, 3), x.shrink_towards_end_to(Duration::seconds(5))); + /// assert_eq!( + /// TimeWindow::from_seconds(3, 3), + /// x.shrink_towards_end_to(Duration::seconds(-1)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(3, 3), + /// x.shrink_towards_end_to(Duration::seconds(0)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(2, 3), + /// x.shrink_towards_end_to(Duration::seconds(1)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(1, 3), + /// x.shrink_towards_end_to(Duration::seconds(5)) + /// ); /// ``` pub fn shrink_towards_end_to(self, new_duration: Duration) -> TimeWindow { let duration = new_duration @@ -570,19 +583,31 @@ impl TimeWindow { TimeWindow::from_end(duration, self.end) } - /// Prepones the time window end so that the new duration matches the given value. - /// Is a No-Op if the new duration is smaller than the current one. - /// Negative durations set the result time window size to zero. - /// # Examples + /// Prepones the time window end so that the new duration matches the given + /// value. Is a No-Op if the new duration is smaller than the current + /// one. Negative durations set the result time window size to zero. /// + /// # Examples /// ``` /// # use tinytime::Duration; /// # use tinytime::TimeWindow; /// let x = TimeWindow::from_seconds(1, 3); - /// assert_eq!(TimeWindow::from_seconds(1, 1), x.shrink_towards_start_to(Duration::seconds(-1))); - /// assert_eq!(TimeWindow::from_seconds(1, 1), x.shrink_towards_start_to(Duration::seconds(0))); - /// assert_eq!(TimeWindow::from_seconds(1, 2), x.shrink_towards_start_to(Duration::seconds(1))); - /// assert_eq!(TimeWindow::from_seconds(1, 3), x.shrink_towards_start_to(Duration::seconds(5))); + /// assert_eq!( + /// TimeWindow::from_seconds(1, 1), + /// x.shrink_towards_start_to(Duration::seconds(-1)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(1, 1), + /// x.shrink_towards_start_to(Duration::seconds(0)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(1, 2), + /// x.shrink_towards_start_to(Duration::seconds(1)) + /// ); + /// assert_eq!( + /// TimeWindow::from_seconds(1, 3), + /// x.shrink_towards_start_to(Duration::seconds(5)) + /// ); /// ``` pub fn shrink_towards_start_to(self, new_duration: Duration) -> TimeWindow { let duration = new_duration