Skip to content

Commit 234d68b

Browse files
committed
Improve expand_type.
1 parent e1e5c14 commit 234d68b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,14 +489,17 @@ fn expand_trait_item(ti: ast::TraitItem, fld: &mut MacroExpander)
489489
}
490490

491491
pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
492-
let t = match t.node.clone() {
492+
let t = match t.node {
493+
ast::TyKind::Mac(_) => t.unwrap(),
494+
_ => return fold::noop_fold_ty(t, fld),
495+
};
496+
497+
match t.node {
493498
ast::TyKind::Mac(mac) => {
494499
expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
495500
}
496-
_ => t
497-
};
498-
499-
fold::noop_fold_ty(t, fld)
501+
_ => unreachable!(),
502+
}
500503
}
501504

502505
/// A tree-folder that performs macro expansion

0 commit comments

Comments
 (0)