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.
This commit is contained in:
bors 2019-02-06 06:01:37 +00:00
commit 2596bc1368
24 changed files with 1791 additions and 2004 deletions

View file

@ -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)
};