diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-07-05 15:42:28 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-07-10 07:11:29 -0400 |
| commit | 11d521676fbc371a7dffa195ee94075dc0558862 (patch) | |
| tree | 50b3a8e5c3c9913e0d5204374264d3f99fcf330a /src/libsyntax | |
| parent | a440337e2bfc41e59a001a1460231ef920978ad5 (diff) | |
| download | rust-11d521676fbc371a7dffa195ee94075dc0558862.tar.gz rust-11d521676fbc371a7dffa195ee94075dc0558862.zip | |
Move lifetime_to_string to Display impl
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c627596bbdf..8801e89a0cf 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 512023ff030..16610e22048 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)) } |
