diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c627596bbdf2..8801e89a0cfc 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -50,11 +50,17 @@ impl fmt::Debug for Lifetime { f, "lifetime({}: {})", self.id, - pprust::lifetime_to_string(self) + self ) } } +impl fmt::Display for Lifetime { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.ident.name.as_str()) + } +} + /// A "Path" is essentially Rust's notion of a name. /// /// It's represented as a sequence of identifiers, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 512023ff0303..16610e220487 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -326,10 +326,6 @@ pub fn expr_to_string(e: &ast::Expr) -> String { to_string(|s| s.print_expr(e)) } -pub fn lifetime_to_string(lt: &ast::Lifetime) -> String { - to_string(|s| s.print_lifetime(*lt)) -} - pub fn tt_to_string(tt: tokenstream::TokenTree) -> String { to_string(|s| s.print_tt(tt, false)) }