diff options
| author | Christopher Chambers <chris.chambers@peanutcode.com> | 2015-04-10 23:06:34 -0500 |
|---|---|---|
| committer | Christopher Chambers <chris.chambers@peanutcode.com> | 2015-04-10 23:42:40 -0500 |
| commit | 22eb3193a62fa01e97bf53d5f5aa74ca8ea57a67 (patch) | |
| tree | 04d19566becd5f46a167f8117ad881bbc5d58748 /src/libsyntax/ext | |
| parent | fae29e497c08fcdde8a429a7e2b656e7a8b6cc17 (diff) | |
| download | rust-22eb3193a62fa01e97bf53d5f5aa74ca8ea57a67.tar.gz rust-22eb3193a62fa01e97bf53d5f5aa74ca8ea57a67.zip | |
Simplifications to statement macro handling.
SmallVector::pop no longer worries about converting a Many repr downward to One or Zero. expand_stmt makes use of `if let` for style purposes.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 4a6c45b5be5..8e6b5f85440 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -772,20 +772,17 @@ fn expand_stmt(stmt: P<Stmt>, fld: &mut MacroExpander) -> SmallVector<P<Stmt>> { // If this is a macro invocation with a semicolon, then apply that // semicolon to the final statement produced by expansion. if style == MacStmtWithSemicolon { - match fully_expanded.pop() { - Some(stmt) => { - let new_stmt = stmt.map(|Spanned {node, span}| { - Spanned { - node: match node { - StmtExpr(e, stmt_id) => StmtSemi(e, stmt_id), - _ => node /* might already have a semi */ - }, - span: span - } - }); - fully_expanded.push(new_stmt); - } - None => (), + if let Some(stmt) = fully_expanded.pop() { + let new_stmt = stmt.map(|Spanned {node, span}| { + Spanned { + node: match node { + StmtExpr(e, stmt_id) => StmtSemi(e, stmt_id), + _ => node /* might already have a semi */ + }, + span: span + } + }); + fully_expanded.push(new_stmt); } } |
