libsyntax -- combine two iter ops into one so that fld
does not need to be mutably shared between them both
This commit is contained in:
parent
e3ca1c2fca
commit
ec6d122826
1 changed files with 6 additions and 5 deletions
|
@ -709,14 +709,15 @@ pub fn expand_block(blk: &Block, fld: &mut MacroExpander) -> P<Block> {
|
||||||
// expand the elements of a block.
|
// expand the elements of a block.
|
||||||
pub fn expand_block_elts(b: &Block, fld: &mut MacroExpander) -> P<Block> {
|
pub fn expand_block_elts(b: &Block, fld: &mut MacroExpander) -> P<Block> {
|
||||||
let new_view_items = b.view_items.map(|x| fld.fold_view_item(x));
|
let new_view_items = b.view_items.map(|x| fld.fold_view_item(x));
|
||||||
let new_stmts = b.stmts.iter()
|
let new_stmts =
|
||||||
.map(|x| {
|
b.stmts.iter().flat_map(|x| {
|
||||||
|
let renamed_stmt = {
|
||||||
let pending_renames = &mut fld.extsbox.info().pending_renames;
|
let pending_renames = &mut fld.extsbox.info().pending_renames;
|
||||||
let mut rename_fld = renames_to_fold(pending_renames);
|
let mut rename_fld = renames_to_fold(pending_renames);
|
||||||
rename_fld.fold_stmt(*x).expect_one("rename_fold didn't return one value")
|
rename_fld.fold_stmt(*x).expect_one("rename_fold didn't return one value")
|
||||||
})
|
};
|
||||||
.flat_map(|x| fld.fold_stmt(x).move_iter())
|
fld.fold_stmt(renamed_stmt).move_iter()
|
||||||
.collect();
|
}).collect();
|
||||||
let new_expr = b.expr.map(|x| {
|
let new_expr = b.expr.map(|x| {
|
||||||
let expr = {
|
let expr = {
|
||||||
let pending_renames = &mut fld.extsbox.info().pending_renames;
|
let pending_renames = &mut fld.extsbox.info().pending_renames;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue