Factor out AttrsTarget
flattening code.
This commit does the following. - Pulls the code out of `AttrTokenStream::to_token_trees` into a new function `attrs_and_tokens_to_token_trees`. - Simplifies `TokenStream::from_ast` by calling the new function. This is nicer than the old way, which created a temporary `AttrTokenStream` containing a single `AttrsTarget` (which required some cloning) just to call `to_token_trees` on it. (It is good to remove this use of `AttrsTarget` which isn't related to `cfg_attr` expansion.)
This commit is contained in:
parent
d8b6aa6d0d
commit
d6ebbbfcb2
2 changed files with 72 additions and 65 deletions
|
@ -283,7 +283,10 @@ impl<'a> StripUnconfigured<'a> {
|
|||
.flat_map(|item| self.process_cfg_attr(&self.expand_cfg_attr_item(cfg_attr, item)))
|
||||
.collect()
|
||||
} else {
|
||||
expanded_attrs.into_iter().map(|item| self.expand_cfg_attr_item(cfg_attr, item)).collect()
|
||||
expanded_attrs
|
||||
.into_iter()
|
||||
.map(|item| self.expand_cfg_attr_item(cfg_attr, item))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue