@@ -102,7 +102,7 @@ impl<Tz: TimeZone> DateTime<Tz> {
102102 /// use chrono::prelude::*;
103103 ///
104104 /// let date: DateTime<Utc> = Utc.with_ymd_and_hms(2020, 1, 1, 0, 0, 0).unwrap();
105- /// let other: DateTime<FixedOffset> = FixedOffset::east_opt (23).unwrap().with_ymd_and_hms(2020, 1, 1, 0, 0, 0).unwrap();
105+ /// let other: DateTime<FixedOffset> = FixedOffset::east (23).unwrap().with_ymd_and_hms(2020, 1, 1, 0, 0, 0).unwrap();
106106 /// assert_eq!(date.date_naive(), other.date_naive());
107107 /// ```
108108 #[ inline]
@@ -493,7 +493,7 @@ impl<Tz: TimeZone> DateTime<Tz> {
493493 /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
494494 /// "2018-01-26T18:30:09Z");
495495 ///
496- /// let pst = FixedOffset::east_opt (8 * 60 * 60).unwrap();
496+ /// let pst = FixedOffset::east (8 * 60 * 60).unwrap();
497497 /// let dt = pst.from_local_datetime(&NaiveDate::from_ymd_opt(2018, 1, 26).unwrap().and_hms_micro_opt(10, 30, 9, 453_829).unwrap()).unwrap();
498498 /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
499499 /// "2018-01-26T10:30:09+08:00");
@@ -594,7 +594,7 @@ impl Default for DateTime<Local> {
594594
595595impl Default for DateTime < FixedOffset > {
596596 fn default ( ) -> Self {
597- FixedOffset :: west_opt ( 0 ) . unwrap ( ) . from_utc_datetime ( & NaiveDateTime :: default ( ) )
597+ FixedOffset :: west ( 0 ) . unwrap ( ) . from_utc_datetime ( & NaiveDateTime :: default ( ) )
598598 }
599599}
600600
@@ -605,7 +605,7 @@ impl From<DateTime<Utc>> for DateTime<FixedOffset> {
605605 /// Conversion is done via [`DateTime::with_timezone`]. Note that the converted value returned by
606606 /// this will be created with a fixed timezone offset of 0.
607607 fn from ( src : DateTime < Utc > ) -> Self {
608- src. with_timezone ( & FixedOffset :: east_opt ( 0 ) . unwrap ( ) )
608+ src. with_timezone ( & FixedOffset :: east ( 0 ) . unwrap ( ) )
609609 }
610610}
611611
@@ -707,7 +707,7 @@ impl DateTime<FixedOffset> {
707707 /// # use chrono::{DateTime, FixedOffset, TimeZone};
708708 /// assert_eq!(
709709 /// DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 GMT").unwrap(),
710- /// FixedOffset::east_opt (0).unwrap().with_ymd_and_hms(2015, 2, 18, 23, 16, 9).unwrap()
710+ /// FixedOffset::east (0).unwrap().with_ymd_and_hms(2015, 2, 18, 23, 16, 9).unwrap()
711711 /// );
712712 /// ```
713713 pub fn parse_from_rfc2822 ( s : & str ) -> ParseResult < DateTime < FixedOffset > > {
@@ -758,7 +758,7 @@ impl DateTime<FixedOffset> {
758758 ///
759759 /// let dt = DateTime::parse_from_str(
760760 /// "1983 Apr 13 12:09:14.274 +0000", "%Y %b %d %H:%M:%S%.3f %z");
761- /// assert_eq!(dt, Ok(FixedOffset::east_opt (0).unwrap().from_local_datetime(&NaiveDate::from_ymd_opt(1983, 4, 13).unwrap().and_hms_milli_opt(12, 9, 14, 274).unwrap()).unwrap()));
761+ /// assert_eq!(dt, Ok(FixedOffset::east (0).unwrap().from_local_datetime(&NaiveDate::from_ymd_opt(1983, 4, 13).unwrap().and_hms_milli_opt(12, 9, 14, 274).unwrap()).unwrap()));
762762 /// ```
763763 pub fn parse_from_str ( s : & str , fmt : & str ) -> ParseResult < DateTime < FixedOffset > > {
764764 let mut parsed = Parsed :: new ( ) ;
@@ -787,7 +787,7 @@ impl DateTime<FixedOffset> {
787787 /// "2015-02-18 23:16:09 +0200 trailing text", "%Y-%m-%d %H:%M:%S %z").unwrap();
788788 /// assert_eq!(
789789 /// datetime,
790- /// FixedOffset::east_opt (2*3600).unwrap().with_ymd_and_hms(2015, 2, 18, 23, 16, 9).unwrap()
790+ /// FixedOffset::east (2*3600).unwrap().with_ymd_and_hms(2015, 2, 18, 23, 16, 9).unwrap()
791791 /// );
792792 /// assert_eq!(remainder, " trailing text");
793793 /// ```
@@ -1137,8 +1137,8 @@ impl<Tz: TimeZone, Tz2: TimeZone> PartialOrd<DateTime<Tz2>> for DateTime<Tz> {
11371137 /// ```
11381138 /// use chrono::prelude::*;
11391139 ///
1140- /// let earlier = Utc.with_ymd_and_hms(2015, 5, 15, 2, 0, 0).unwrap().with_timezone(&FixedOffset::west_opt (1 * 3600).unwrap());
1141- /// let later = Utc.with_ymd_and_hms(2015, 5, 15, 3, 0, 0).unwrap().with_timezone(&FixedOffset::west_opt (5 * 3600).unwrap());
1140+ /// let earlier = Utc.with_ymd_and_hms(2015, 5, 15, 2, 0, 0).unwrap().with_timezone(&FixedOffset::west (1 * 3600).unwrap());
1141+ /// let later = Utc.with_ymd_and_hms(2015, 5, 15, 3, 0, 0).unwrap().with_timezone(&FixedOffset::west (5 * 3600).unwrap());
11421142 ///
11431143 /// assert_eq!(earlier.to_string(), "2015-05-15 01:00:00 -01:00");
11441144 /// assert_eq!(later.to_string(), "2015-05-14 22:00:00 -05:00");
@@ -1645,14 +1645,14 @@ where
16451645
16461646 assert_eq ! (
16471647 to_string_fixed(
1648- & FixedOffset :: east_opt ( 3660 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
1648+ & FixedOffset :: east ( 3660 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
16491649 )
16501650 . ok( ) ,
16511651 Some ( r#""2014-07-24T12:34:06+01:01""# . into( ) )
16521652 ) ;
16531653 assert_eq ! (
16541654 to_string_fixed(
1655- & FixedOffset :: east_opt ( 3650 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
1655+ & FixedOffset :: east ( 3650 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
16561656 )
16571657 . ok( ) ,
16581658 // An offset with seconds is not allowed by RFC 3339, so we round it to the nearest minute.
@@ -1689,13 +1689,13 @@ fn test_decodable_json<FUtc, FFixed, FLocal, E>(
16891689 assert_eq ! (
16901690 norm( & fixed_from_str( r#""2014-07-24T12:34:06Z""# ) . ok( ) ) ,
16911691 norm( & Some (
1692- FixedOffset :: east_opt ( 0 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
1692+ FixedOffset :: east ( 0 ) . unwrap( ) . with_ymd_and_hms( 2014 , 7 , 24 , 12 , 34 , 6 ) . unwrap( )
16931693 ) )
16941694 ) ;
16951695 assert_eq ! (
16961696 norm( & fixed_from_str( r#""2014-07-24T13:57:06+01:23""# ) . ok( ) ) ,
16971697 norm( & Some (
1698- FixedOffset :: east_opt ( 60 * 60 + 23 * 60 )
1698+ FixedOffset :: east ( 60 * 60 + 23 * 60 )
16991699 . unwrap( )
17001700 . with_ymd_and_hms( 2014 , 7 , 24 , 13 , 57 , 6 )
17011701 . unwrap( )
0 commit comments