aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/mbe_expander/transcriber.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe/src/mbe_expander/transcriber.rs')
-rw-r--r--crates/ra_mbe/src/mbe_expander/transcriber.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_mbe/src/mbe_expander/transcriber.rs b/crates/ra_mbe/src/mbe_expander/transcriber.rs
index ed094d5bb..f7636db11 100644
--- a/crates/ra_mbe/src/mbe_expander/transcriber.rs
+++ b/crates/ra_mbe/src/mbe_expander/transcriber.rs
@@ -50,7 +50,7 @@ pub(super) fn transcribe(
50 template: &tt::Subtree, 50 template: &tt::Subtree,
51 bindings: &Bindings, 51 bindings: &Bindings,
52) -> Result<tt::Subtree, ExpandError> { 52) -> Result<tt::Subtree, ExpandError> {
53 assert!(template.delimiter == tt::Delimiter::None); 53 assert!(template.delimiter == None);
54 let mut ctx = ExpandCtx { bindings: &bindings, nesting: Vec::new(), var_expanded: false }; 54 let mut ctx = ExpandCtx { bindings: &bindings, nesting: Vec::new(), var_expanded: false };
55 expand_subtree(&mut ctx, template) 55 expand_subtree(&mut ctx, template)
56} 56}
@@ -106,7 +106,7 @@ fn expand_var(ctx: &mut ExpandCtx, v: &SmolStr) -> Result<Fragment, ExpandError>
106 // ``` 106 // ```
107 // We just treat it a normal tokens 107 // We just treat it a normal tokens
108 let tt = tt::Subtree { 108 let tt = tt::Subtree {
109 delimiter: tt::Delimiter::None, 109 delimiter: None,
110 token_trees: vec![ 110 token_trees: vec![
111 tt::Leaf::from(tt::Punct { char: '$', spacing: tt::Spacing::Alone }).into(), 111 tt::Leaf::from(tt::Punct { char: '$', spacing: tt::Spacing::Alone }).into(),
112 tt::Leaf::from(tt::Ident { text: v.clone(), id: tt::TokenId::unspecified() }) 112 tt::Leaf::from(tt::Ident { text: v.clone(), id: tt::TokenId::unspecified() })
@@ -147,7 +147,7 @@ fn expand_repeat(
147 ctx.var_expanded = false; 147 ctx.var_expanded = false;
148 148
149 while let Ok(mut t) = expand_subtree(ctx, template) { 149 while let Ok(mut t) = expand_subtree(ctx, template) {
150 t.delimiter = tt::Delimiter::None; 150 t.delimiter = None;
151 // if no var expanded in the child, we count it as a fail 151 // if no var expanded in the child, we count it as a fail
152 if !ctx.var_expanded { 152 if !ctx.var_expanded {
153 break; 153 break;
@@ -212,7 +212,7 @@ fn expand_repeat(
212 212
213 // Check if it is a single token subtree without any delimiter 213 // Check if it is a single token subtree without any delimiter
214 // e.g {Delimiter:None> ['>'] /Delimiter:None>} 214 // e.g {Delimiter:None> ['>'] /Delimiter:None>}
215 let tt = tt::Subtree { delimiter: tt::Delimiter::None, token_trees: buf }.into(); 215 let tt = tt::Subtree { delimiter: None, token_trees: buf }.into();
216 Ok(Fragment::Tokens(tt)) 216 Ok(Fragment::Tokens(tt))
217} 217}
218 218
@@ -225,7 +225,7 @@ fn push_fragment(buf: &mut Vec<tt::TokenTree>, fragment: Fragment) {
225 225
226fn push_subtree(buf: &mut Vec<tt::TokenTree>, tt: tt::Subtree) { 226fn push_subtree(buf: &mut Vec<tt::TokenTree>, tt: tt::Subtree) {
227 match tt.delimiter { 227 match tt.delimiter {
228 tt::Delimiter::None => buf.extend(tt.token_trees), 228 None => buf.extend(tt.token_trees),
229 _ => buf.push(tt.into()), 229 _ => buf.push(tt.into()),
230 } 230 }
231} 231}