diff options
Diffstat (limited to 'crates/mbe/src/benchmark.rs')
-rw-r--r-- | crates/mbe/src/benchmark.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/crates/mbe/src/benchmark.rs b/crates/mbe/src/benchmark.rs index 503ad1355..ba814a2e1 100644 --- a/crates/mbe/src/benchmark.rs +++ b/crates/mbe/src/benchmark.rs | |||
@@ -120,7 +120,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt | |||
120 | Some("pat") => parent.token_trees.push(make_ident("foo")), | 120 | Some("pat") => parent.token_trees.push(make_ident("foo")), |
121 | Some("path") => parent.token_trees.push(make_ident("foo")), | 121 | Some("path") => parent.token_trees.push(make_ident("foo")), |
122 | Some("literal") => parent.token_trees.push(make_literal("1")), | 122 | Some("literal") => parent.token_trees.push(make_literal("1")), |
123 | Some("expr") => parent.token_trees.push(make_ident("foo").into()), | 123 | Some("expr") => parent.token_trees.push(make_ident("foo")), |
124 | Some("lifetime") => { | 124 | Some("lifetime") => { |
125 | parent.token_trees.push(make_punct('\'')); | 125 | parent.token_trees.push(make_punct('\'')); |
126 | parent.token_trees.push(make_ident("a")); | 126 | parent.token_trees.push(make_ident("a")); |
@@ -157,17 +157,15 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt | |||
157 | if i + 1 != cnt { | 157 | if i + 1 != cnt { |
158 | if let Some(sep) = separator { | 158 | if let Some(sep) = separator { |
159 | match sep { | 159 | match sep { |
160 | Separator::Literal(it) => parent | 160 | Separator::Literal(it) => { |
161 | .token_trees | 161 | parent.token_trees.push(tt::Leaf::Literal(it.clone()).into()) |
162 | .push(tt::Leaf::Literal(it.clone().into()).into()), | 162 | } |
163 | Separator::Ident(it) => parent | 163 | Separator::Ident(it) => { |
164 | .token_trees | 164 | parent.token_trees.push(tt::Leaf::Ident(it.clone()).into()) |
165 | .push(tt::Leaf::Ident(it.clone().into()).into()), | 165 | } |
166 | Separator::Puncts(puncts) => { | 166 | Separator::Puncts(puncts) => { |
167 | for it in puncts { | 167 | for it in puncts { |
168 | parent | 168 | parent.token_trees.push(tt::Leaf::Punct(*it).into()) |
169 | .token_trees | ||
170 | .push(tt::Leaf::Punct(it.clone().into()).into()) | ||
171 | } | 169 | } |
172 | } | 170 | } |
173 | }; | 171 | }; |
@@ -176,8 +174,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt | |||
176 | } | 174 | } |
177 | } | 175 | } |
178 | Op::Subtree { tokens, delimiter } => { | 176 | Op::Subtree { tokens, delimiter } => { |
179 | let mut subtree = | 177 | let mut subtree = tt::Subtree { delimiter: *delimiter, token_trees: Vec::new() }; |
180 | tt::Subtree { delimiter: delimiter.clone(), token_trees: Vec::new() }; | ||
181 | tokens.iter().for_each(|it| { | 178 | tokens.iter().for_each(|it| { |
182 | collect_from_op(it, &mut subtree, seed); | 179 | collect_from_op(it, &mut subtree, seed); |
183 | }); | 180 | }); |