File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,10 +43,7 @@ impl Event {
4343 /// ```
4444 #[ inline]
4545 pub fn at ( instant : DateTime ) -> Event {
46- Event {
47- start : instant,
48- end : None ,
49- }
46+ Event :: new_unchecked ( instant, None )
5047 }
5148
5249 /// Creates a new `Event` which spans from a `start` (inclusive) to an `end` (exclusive).
@@ -95,17 +92,14 @@ impl Event {
9592 return Err ( Error :: datetime_range ( "event" , start..end) ) ;
9693 }
9794
98- Ok ( Event :: new_unchecked ( start, end) )
95+ Ok ( Event :: new_unchecked ( start, Some ( end) ) )
9996 }
10097
101- /// Creates a new `Event` which spans from a `start` (inclusive) to an `end` (exclusive)
102- /// without checking that `end` is strictly greater than `start`.
98+ /// Creates a new `Event` which spans from a `start` (inclusive) to an optional `end`
99+ /// (exclusive) without checking that `end` is strictly greater than `start`.
103100 #[ inline]
104- pub ( crate ) fn new_unchecked ( start : DateTime , end : DateTime ) -> Event {
105- Event {
106- start,
107- end : Some ( end) ,
108- }
101+ pub ( crate ) fn new_unchecked ( start : DateTime , end : Option < DateTime > ) -> Event {
102+ Event { start, end }
109103 }
110104
111105 /// Returns the `DateTime` at which the event starts.
Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ where
450450 fn get_event_unchecked ( & self , start : DateTime ) -> Option < Event > {
451451 if self . event_duration . is_positive ( ) {
452452 let end = start. checked_add ( self . event_duration ) . ok ( ) ?;
453- Some ( Event :: new_unchecked ( start, end) )
453+ Some ( Event :: new_unchecked ( start, Some ( end) ) )
454454 } else {
455455 Some ( Event :: at ( start) )
456456 }
You can’t perform that action at this time.
0 commit comments