Skip to content

Commit 11d5216

Browse files
Move lifetime_to_string to Display impl
1 parent a440337 commit 11d5216

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/libsyntax/ast.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@ impl fmt::Debug for Lifetime {
5050
f,
5151
"lifetime({}: {})",
5252
self.id,
53-
pprust::lifetime_to_string(self)
53+
self
5454
)
5555
}
5656
}
5757

58+
impl fmt::Display for Lifetime {
59+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
60+
write!(f, "{}", self.ident.name.as_str())
61+
}
62+
}
63+
5864
/// A "Path" is essentially Rust's notion of a name.
5965
///
6066
/// It's represented as a sequence of identifiers,

src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,6 @@ pub fn expr_to_string(e: &ast::Expr) -> String {
326326
to_string(|s| s.print_expr(e))
327327
}
328328

329-
pub fn lifetime_to_string(lt: &ast::Lifetime) -> String {
330-
to_string(|s| s.print_lifetime(*lt))
331-
}
332-
333329
pub fn tt_to_string(tt: tokenstream::TokenTree) -> String {
334330
to_string(|s| s.print_tt(tt, false))
335331
}

0 commit comments

Comments
 (0)