Rename TokenStream::empty to TokenStream::new
There is no precedent for the `empty` name -- we do not have `Vec::empty` or `HashMap::empty` etc.
This commit is contained in:
@@ -93,7 +93,7 @@ impl !Sync for LexError {}
|
||||
impl TokenStream {
|
||||
/// Returns an empty `TokenStream` containing no token trees.
|
||||
#[unstable(feature = "proc_macro", issue = "38356")]
|
||||
pub fn empty() -> TokenStream {
|
||||
pub fn new() -> TokenStream {
|
||||
TokenStream(tokenstream::TokenStream::empty())
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ macro_rules! quote_tree {
|
||||
}
|
||||
|
||||
macro_rules! quote {
|
||||
() => { TokenStream::empty() };
|
||||
() => { TokenStream::new() };
|
||||
($($t:tt)*) => {
|
||||
[$(quote_tree!($t),)*].iter()
|
||||
.cloned()
|
||||
@@ -104,7 +104,7 @@ impl<T: Quote> Quote for Option<T> {
|
||||
impl Quote for TokenStream {
|
||||
fn quote(self) -> TokenStream {
|
||||
if self.is_empty() {
|
||||
return quote!(::TokenStream::empty());
|
||||
return quote!(::TokenStream::new());
|
||||
}
|
||||
let mut after_dollar = false;
|
||||
let tokens = self.into_iter().filter_map(|tree| {
|
||||
|
||||
Reference in New Issue
Block a user