From 667973204d5ff01a92eef35c54d004797413b8a2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 8 Mar 2018 13:16:36 -0800 Subject: Note the future epoch for epoch lints --- src/libsyntax/epoch.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/epoch.rs b/src/libsyntax/epoch.rs index 603729f0de0..32cbc79c550 100644 --- a/src/libsyntax/epoch.rs +++ b/src/libsyntax/epoch.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::fmt; use std::str::FromStr; /// The epoch of the compiler (RFC 2052) @@ -37,12 +38,13 @@ pub enum Epoch { // must be in order from oldest to newest pub const ALL_EPOCHS: &[Epoch] = &[Epoch::Epoch2015, Epoch::Epoch2018]; -impl ToString for Epoch { - fn to_string(&self) -> String { - match *self { - Epoch::Epoch2015 => "2015".into(), - Epoch::Epoch2018 => "2018".into(), - } +impl fmt::Display for Epoch { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let s = match *self { + Epoch::Epoch2015 => "2015", + Epoch::Epoch2018 => "2018", + }; + write!(f, "{}", s) } } -- cgit 1.4.1-3-g733a5