Move lifetime_to_string to Display impl
This commit is contained in:
parent
a440337e2b
commit
11d521676f
2 changed files with 7 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue