about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-10-10 07:29:02 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2019-10-14 09:14:39 +1100
commit5c93492da914f972fb549e95db778adcbdf70480 (patch)
treec80325183ecf62fe27acb5444fc27d255e8180b2 /src/libsyntax/parse
parent20cc75272619cc452e3ae6c131e61974f6aa9929 (diff)
downloadrust-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/parse')
-rw-r--r--src/libsyntax/parse/attr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index e74f3045db8..0963efcfc8a 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -203,7 +203,7 @@ impl<'a> Parser<'a> {
                 };
                 TokenStream::from_streams(smallvec![eq.into(), tokens])
             } else {
-                TokenStream::empty()
+                TokenStream::default()
             };
             ast::AttrItem { path, tokens }
         })