diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-10 07:29:02 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-14 09:14:39 +1100 |
| commit | 5c93492da914f972fb549e95db778adcbdf70480 (patch) | |
| tree | c80325183ecf62fe27acb5444fc27d255e8180b2 /src/libsyntax_ext | |
| parent | 20cc75272619cc452e3ae6c131e61974f6aa9929 (diff) | |
| download | rust-5c93492da914f972fb549e95db778adcbdf70480.tar.gz rust-5c93492da914f972fb549e95db778adcbdf70480.zip | |
Remove the `Option` in `TokenStream`.
It means an allocation is required to create an empty `TokenStream`, but all other operations are simpler and marginally faster due to not having to check for `None`. Overall it simplifies the code for a negligible performance effect. The commit also removes `TokenStream::empty` by implementing `Default`, which is now possible.
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/plugin_macro_defs.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax_ext/plugin_macro_defs.rs b/src/libsyntax_ext/plugin_macro_defs.rs index 315babceae3..62c7e188eba 100644 --- a/src/libsyntax_ext/plugin_macro_defs.rs +++ b/src/libsyntax_ext/plugin_macro_defs.rs @@ -20,7 +20,7 @@ fn plugin_macro_def(name: Name, span: Span) -> P<Item> { attr::mk_word_item(Ident::new(sym::rustc_builtin_macro, span))); let parens: TreeAndJoint = TokenTree::Delimited( - DelimSpan::from_single(span), token::Paren, TokenStream::empty() + DelimSpan::from_single(span), token::Paren, TokenStream::default() ).into(); let trees = vec![parens.clone(), TokenTree::token(token::FatArrow, span).into(), parens]; |
