From eddc3ccce8d50634f860cd1f79f2f242eed7be0f Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 16 Jul 2014 22:16:55 -0400 Subject: [PATCH] syntax: Add ToTokens for Option --- src/libsyntax/ext/quote.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 696d62838ba79..0eab9a90b956b 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -67,6 +67,15 @@ pub mod rt { } } + impl ToTokens for Option { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + match self { + &Some(ref t) => t.to_tokens(cx), + &None => Vec::new(), + } + } + } + /* Should be (when bugs in default methods are fixed): trait ToSource : ToTokens {