|
1 | 1 | // Code that generates a test runner to run all the tests in a crate |
2 | 2 |
|
3 | 3 | use std::mem; |
4 | | -use std::ops::DerefMut; |
5 | 4 |
|
6 | 5 | use rustc_ast as ast; |
7 | 6 | use rustc_ast::entry::EntryPointType; |
@@ -130,8 +129,9 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> { |
130 | 129 | c.items.push(mk_main(&mut self.cx)); |
131 | 130 | } |
132 | 131 |
|
133 | | - fn visit_item(&mut self, i: &mut P<ast::Item>) { |
134 | | - let item = i.deref_mut(); |
| 132 | + fn visit_item(&mut self, item: &mut P<ast::Item>) { |
| 133 | + let item = &mut **item; |
| 134 | + |
135 | 135 | if let Some(name) = get_test_name(&item) { |
136 | 136 | debug!("this is a test item"); |
137 | 137 |
|
@@ -198,13 +198,11 @@ struct EntryPointCleaner<'a> { |
198 | 198 | } |
199 | 199 |
|
200 | 200 | impl<'a> MutVisitor for EntryPointCleaner<'a> { |
201 | | - fn visit_item(&mut self, i: &mut P<ast::Item>) { |
| 201 | + fn visit_item(&mut self, item: &mut P<ast::Item>) { |
202 | 202 | self.depth += 1; |
203 | | - ast::mut_visit::walk_item(self, i, ()); |
| 203 | + ast::mut_visit::walk_item(self, item, ()); |
204 | 204 | self.depth -= 1; |
205 | 205 |
|
206 | | - let item = i.deref_mut(); |
207 | | - |
208 | 206 | // Remove any #[rustc_main] or #[start] from the AST so it doesn't |
209 | 207 | // clash with the one we're going to add, but mark it as |
210 | 208 | // #[allow(dead_code)] to avoid printing warnings. |
|
0 commit comments