diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs index 35dbd8ccfc..3c16973621 100644 --- a/tests/test_precedence.rs +++ b/tests/test_precedence.rs @@ -15,7 +15,6 @@ //! 5. Compare the expressions with one another, if they are not equal fail. extern crate rustc_data_structures; -extern crate smallvec; extern crate syntax; extern crate syntax_pos; @@ -24,7 +23,6 @@ mod features; use quote::quote; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use regex::Regex; -use smallvec::smallvec; use syntax::ast; use syntax::ptr::P; use syntax_pos::edition::Edition; @@ -211,16 +209,57 @@ fn libsyntax_parse_and_rewrite(input: &str) -> Option
> {
/// This method operates on libsyntax objects.
fn libsyntax_brackets(mut libsyntax_expr: P > {
use rustc_data_structures::thin_vec::ThinVec;
- use smallvec::SmallVec;
use std::mem;
- use syntax::ast::{Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty};
- use syntax::mut_visit::{noop_visit_expr, MutVisitor};
+ use syntax::ast::{Block, Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty};
+ use syntax::mut_visit::MutVisitor;
+ use syntax::util::map_in_place::MapInPlace;
use syntax_pos::DUMMY_SP;
struct BracketsVisitor {
failed: bool,
};
+ fn flat_map_field >
}
}
- fn flat_map_field(&mut self, mut f: Field) -> SmallVec<[Field; 1]> {
- if f.is_shorthand {
- noop_visit_expr(&mut f.expr, self);
- } else {
- self.visit_expr(&mut f.expr);
- }
- SmallVec::from([f])
+ fn visit_block(&mut self, block: &mut P >
let _ = ty;
}
- fn flat_map_stmt(&mut self, stmt: Stmt) -> SmallVec<[Stmt; 1]> {
- let kind = match stmt.kind {
- // Don't wrap toplevel expressions in statements.
- StmtKind::Expr(mut e) => {
- noop_visit_expr(&mut e, self);
- StmtKind::Expr(e)
- }
- StmtKind::Semi(mut e) => {
- noop_visit_expr(&mut e, self);
- StmtKind::Semi(e)
- }
- s => s,
- };
-
- smallvec![Stmt { kind, ..stmt }]
- }
-
fn visit_mac(&mut self, mac: &mut Mac) {
// By default when folding over macros, libsyntax panics. This is
// because it's usually not what you want, you want to run after