about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-02-06 06:01:37 +0000
committerbors <bors@rust-lang.org>2019-02-06 06:01:37 +0000
commit2596bc1368d1e3d34c9a7841ad87a3100f01cbad (patch)
tree228807b2099d942bb3051f3de737e5f45d7614c7 /src/libsyntax/parse
parent0e5a2099592358317f74ff5cd517a8b6f04cbee1 (diff)
parentbfcbd235a28f989c0e3c1f0a7542f4e5caaf6e0d (diff)
downloadrust-2596bc1368d1e3d34c9a7841ad87a3100f01cbad.tar.gz
rust-2596bc1368d1e3d34c9a7841ad87a3100f01cbad.zip
Auto merge of #58061 - nnethercote:overhaul-syntax-Folder, r=petrochenkov
Overhaul `syntax::fold::Folder`.

This PR changes `syntax::fold::Folder` from a functional style
(where most methods take a `T` and produce a new `T`) to a more
imperative style (where most methods take and modify a `&mut T`), and
renames it `syntax::mut_visit::MutVisitor`.

This makes the code faster and more concise.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs3
-rw-r--r--src/libsyntax/parse/token.rs2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1c02a80df46..bbd1770e9c6 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -7054,7 +7054,8 @@ impl<'a> Parser<'a> {
                 sess: self.sess,
                 features: None, // don't perform gated feature checking
             };
-            let outer_attrs = strip_unconfigured.process_cfg_attrs(outer_attrs.to_owned());
+            let mut outer_attrs = outer_attrs.to_owned();
+            strip_unconfigured.process_cfg_attrs(&mut outer_attrs);
             (!self.cfg_mods || strip_unconfigured.in_cfg(&outer_attrs), outer_attrs)
         };
 
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index f06e975a6d9..5181bb8f34e 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -735,7 +735,7 @@ impl fmt::Debug for LazyTokenStream {
 }
 
 impl LazyTokenStream {
-    fn new() -> Self {
+    pub fn new() -> Self {
         LazyTokenStream(Lock::new(None))
     }