From ab7c003b6449a9463fd1ee6d44172ef18c7f26c8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 22 Oct 2017 11:54:39 -0700 Subject: [PATCH] Remove associated constants workaround This has been stable since Rust 1.20. --- serde/src/de/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index 758fe462..848183c7 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -1027,6 +1027,10 @@ pub trait Deserializer<'de>: Sized { /// # /// # struct Timestamp; /// # + /// # impl Timestamp { + /// # const EPOCH: Timestamp = Timestamp; + /// # } + /// # /// # impl FromStr for Timestamp { /// # type Err = String; /// # fn from_str(_: &str) -> Result { @@ -1040,7 +1044,7 @@ pub trait Deserializer<'de>: Sized { /// # fn seconds(_: u64) -> Self { unimplemented!() } /// # } /// # - /// # impl Add for () { + /// # impl Add for Timestamp { /// # type Output = Timestamp; /// # fn add(self, _: Duration) -> Self::Output { /// # unimplemented!() @@ -1058,8 +1062,6 @@ pub trait Deserializer<'de>: Sized { /// let s = String::deserialize(deserializer)?; /// Timestamp::from_str(&s).map_err(de::Error::custom) /// } else { - /// # // Make it look like an associated constant but compile on older rustc. - /// # mod Timestamp { pub const EPOCH: () = (); } /// // Deserialize from a compact binary representation, seconds since /// // the Unix epoch. /// let n = u64::deserialize(deserializer)?;