Skip to content

Commit eddc3cc

Browse files
committed
syntax: Add ToTokens for Option<T>
1 parent d3adccd commit eddc3cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ pub mod rt {
6767
}
6868
}
6969

70+
impl<T: ToTokens> ToTokens for Option<T> {
71+
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
72+
match self {
73+
&Some(ref t) => t.to_tokens(cx),
74+
&None => Vec::new(),
75+
}
76+
}
77+
}
78+
7079
/* Should be (when bugs in default methods are fixed):
7180
7281
trait ToSource : ToTokens {

0 commit comments

Comments
 (0)