From 98f98cbb5404385703a404547aa2477d4a2fd1cb Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 13 Dec 2019 21:53:34 +0800 Subject: Refactor tt::Delimiter --- crates/ra_hir_expand/src/quote.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs index 4f698ff13..aa8a5f23f 100644 --- a/crates/ra_hir_expand/src/quote.rs +++ b/crates/ra_hir_expand/src/quote.rs @@ -16,7 +16,7 @@ macro_rules! __quote { { let children = $crate::__quote!($($tt)*); let subtree = tt::Subtree { - delimiter: tt::Delimiter::$delim, + delimiter: Some(tt::Delimiter::$delim), token_trees: $crate::quote::IntoTt::to_tokens(children), }; subtree @@ -124,7 +124,7 @@ pub(crate) trait IntoTt { impl IntoTt for Vec { fn to_subtree(self) -> tt::Subtree { - tt::Subtree { delimiter: tt::Delimiter::None, token_trees: self } + tt::Subtree { delimiter: None, token_trees: self } } fn to_tokens(self) -> Vec { @@ -254,7 +254,8 @@ mod tests { let fields = fields.iter().map(|it| quote!(#it: self.#it.clone(), ).token_trees.clone()).flatten(); - let list = tt::Subtree { delimiter: tt::Delimiter::Brace, token_trees: fields.collect() }; + let list = + tt::Subtree { delimiter: Some(tt::Delimiter::Brace), token_trees: fields.collect() }; let quoted = quote! { impl Clone for #struct_name { -- cgit v1.2.3