Remove usages of Term::as_str and mark it for removal

This commit is contained in:
John Kåre Alsaker
2018-04-09 23:49:25 +02:00
parent 78bcd9b5fe
commit 221b7ca3c2
4 changed files with 8 additions and 7 deletions

View File

@@ -715,6 +715,7 @@ impl Term {
}
}
// FIXME: Remove this, do not stabilize
/// Get a reference to the interned string.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn as_str(&self) -> &str {
@@ -739,7 +740,7 @@ impl Term {
#[unstable(feature = "proc_macro", issue = "38356")]
impl fmt::Display for Term {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.as_str().fmt(f)
self.sym.as_str().fmt(f)
}
}
@@ -1131,7 +1132,7 @@ impl TokenTree {
},
self::TokenTree::Term(tt) => {
let ident = ast::Ident::new(tt.sym, tt.span.0);
let sym_str = tt.sym.as_str();
let sym_str = tt.sym.to_string();
let token = if sym_str.starts_with("'") {
Lifetime(ident)
} else if sym_str.starts_with("r#") {

View File

@@ -183,7 +183,7 @@ impl Quote for Op {
impl Quote for Term {
fn quote(self) -> TokenStream {
quote!(::Term::new((quote self.as_str()), (quote self.span())))
quote!(::Term::new((quote self.sym.as_str()), (quote self.span())))
}
}