77#![ feature( auto_traits) ]
88#![ feature( box_patterns) ]
99#![ feature( const_trait_impl) ]
10- #![ feature( decl_macro) ]
1110#![ feature( coroutines) ]
11+ #![ feature( decl_macro) ]
1212#![ feature( explicit_tail_calls) ]
1313#![ feature( more_qualified_paths) ]
1414#![ feature( raw_ref_op) ]
@@ -97,6 +97,7 @@ fn test_expr() {
9797 // ExprKind::MethodCall
9898 c1 ! ( expr, [ x. f( ) ] , "x.f()" ) ;
9999 c2 ! ( expr, [ x. f:: <u8 >( ) ] , "x.f::<u8>()" , "x.f :: < u8 > ()" ) ;
100+ c2 ! ( expr, [ x. collect:: <Vec <_>>( ) ] , "x.collect::<Vec<_>>()" , "x.collect :: < Vec < _ >> ()" ) ;
100101
101102 // ExprKind::Tup
102103 c1 ! ( expr, [ ( ) ] , "()" ) ;
@@ -107,6 +108,13 @@ fn test_expr() {
107108 // ExprKind::Binary
108109 c1 ! ( expr, [ true || false ] , "true || false" ) ;
109110 c1 ! ( expr, [ true || false && false ] , "true || false && false" ) ;
111+ c1 ! ( expr, [ a < 1 && 2 < b && c > 3 && 4 > d ] , "a < 1 && 2 < b && c > 3 && 4 > d" ) ;
112+ c2 ! ( expr, [ a & b & !c ] , "a & b & !c" , "a & b &! c" ) ; // FIXME
113+ c2 ! ( expr,
114+ [ a + b * c - d + -1 * -2 - -3 ] ,
115+ "a + b * c - d + -1 * -2 - -3" ,
116+ "a + b * c - d + - 1 * - 2 - - 3"
117+ ) ;
110118
111119 // ExprKind::Unary
112120 c2 ! ( expr, [ * expr ] , "*expr" , "* expr" ) ;
@@ -129,18 +137,12 @@ fn test_expr() {
129137
130138 // ExprKind::If
131139 c1 ! ( expr, [ if true { } ] , "if true {}" ) ;
132- c1 ! ( expr,
133- [ if true {
134- } else {
135- } ] ,
136- "if true {} else {}"
137- ) ;
138- c1 ! ( expr,
139- [ if let true = true {
140- } else {
141- } ] ,
142- "if let true = true {} else {}"
140+ c2 ! ( expr,
141+ [ if :: std:: blah( ) { } else { } ] ,
142+ "if ::std::blah() {} else {}" ,
143+ "if :: std :: blah() {} else {}"
143144 ) ;
145+ c1 ! ( expr, [ if let true = true { } else { } ] , "if let true = true {} else {}" ) ;
144146 c1 ! ( expr,
145147 [ if true {
146148 } else if false {
@@ -205,30 +207,16 @@ fn test_expr() {
205207 c1 ! ( expr, [ async move || self ] , "async move || self" ) ;
206208 c1 ! ( expr, [ static || self ] , "static || self" ) ;
207209 c1 ! ( expr, [ static move || self ] , "static move || self" ) ;
208- #[ rustfmt:: skip] // https://github.com/rust-lang/rustfmt/issues/5149
209- c1 ! ( expr,
210- [ static async || self ] ,
211- "static async || self"
212- ) ;
213- #[ rustfmt:: skip] // https://github.com/rust-lang/rustfmt/issues/5149
214- c1 ! ( expr,
215- [ static async move || self ] ,
216- "static async move || self"
217- ) ;
210+ c1 ! ( expr, [ static async || self ] , "static async || self" ) ;
211+ c1 ! ( expr, [ static async move || self ] , "static async move || self" ) ;
218212 c1 ! ( expr, [ || -> u8 { self } ] , "|| -> u8 { self }" ) ;
219213 c2 ! ( expr, [ 1 + || { } ] , "1 + (|| {})" , "1 + || {}" ) ; // AST??
220214
221215 // ExprKind::Block
222216 c1 ! ( expr, [ { } ] , "{}" ) ;
223217 c1 ! ( expr, [ unsafe { } ] , "unsafe {}" ) ;
224218 c2 ! ( expr, [ ' a: { } ] , "'a: {}" , "'a : {}" ) ;
225- c1 ! ( expr,
226- [
227- #[ attr]
228- { }
229- ] ,
230- "#[attr] {}"
231- ) ;
219+ c1 ! ( expr, [ #[ attr] { } ] , "#[attr] {}" ) ;
232220 c2 ! ( expr,
233221 [
234222 {
@@ -316,7 +304,6 @@ fn test_expr() {
316304
317305 // ExprKind::Struct
318306 c1 ! ( expr, [ Struct { } ] , "Struct {}" ) ;
319- #[ rustfmt:: skip] // https://github.com/rust-lang/rustfmt/issues/5151
320307 c2 ! ( expr,
321308 [ <Struct as Trait >:: Type { } ] ,
322309 "<Struct as Trait>::Type {}" ,
@@ -379,6 +366,7 @@ fn test_item() {
379366 "pub use crate::{a, b::c};" ,
380367 "pub use crate :: { a, b :: c } ;"
381368 ) ;
369+ c2 ! ( item, [ pub use A :: * ; ] , "pub use A::*;" , "pub use A :: * ;" ) ;
382370
383371 // ItemKind::Static
384372 c2 ! ( item, [ pub static S : ( ) = { } ; ] , "pub static S: () = {};" , "pub static S : () = {} ;" ) ;
@@ -395,6 +383,16 @@ fn test_item() {
395383 [ pub default const async unsafe extern "C" fn f( ) { } ] ,
396384 "pub default const async unsafe extern \" C\" fn f() {}"
397385 ) ;
386+ c2 ! ( item,
387+ [ fn g<T >( t: Vec <Vec <Vec <T >>>) { } ] ,
388+ "fn g<T>(t: Vec<Vec<Vec<T>>>) {}" ,
389+ "fn g < T > (t : Vec < Vec < Vec < T >> >) {}"
390+ ) ;
391+ c2 ! ( item,
392+ [ fn h<' a>( t: & ' a Vec <Cell <dyn D >>) { } ] ,
393+ "fn h<'a>(t: &'a Vec<Cell<dyn D>>) {}" ,
394+ "fn h < 'a > (t : & 'a Vec < Cell < dyn D >>) {}"
395+ ) ;
398396
399397 // ItemKind::Mod
400398 c2 ! ( item, [ pub mod m; ] , "pub mod m;" , "pub mod m ;" ) ;
@@ -404,21 +402,16 @@ fn test_item() {
404402
405403 // ItemKind::ForeignMod
406404 c1 ! ( item, [ extern "C" { } ] , "extern \" C\" {}" ) ;
407- #[ rustfmt:: skip]
408405 c2 ! ( item,
409406 [ pub extern "C" { } ] ,
410407 "extern \" C\" {}" , // ??
411408 "pub extern \" C\" {}"
412409 ) ;
413- c1 ! ( item,
414- [ unsafe extern "C++" { } ] ,
415- "unsafe extern \" C++\" {}"
416- ) ;
410+ c1 ! ( item, [ unsafe extern "C++" { } ] , "unsafe extern \" C++\" {}" ) ;
417411
418412 // ItemKind::GlobalAsm: untestable because this test works pre-expansion.
419413
420414 // ItemKind::TyAlias
421- #[ rustfmt:: skip]
422415 c2 ! ( item,
423416 [
424417 pub default type Type <' a>: Bound
@@ -579,7 +572,6 @@ fn test_pat() {
579572 c1 ! ( pat, [ Struct { .. } ] , "Struct { .. }" ) ;
580573 c1 ! ( pat, [ Struct { x, .. } ] , "Struct { x, .. }" ) ;
581574 c2 ! ( pat, [ Struct { x: _x, .. } ] , "Struct { x: _x, .. }" , "Struct { x : _x, .. }" ) ;
582- #[ rustfmt:: skip] // https://github.com/rust-lang/rustfmt/issues/5151
583575 c2 ! ( pat,
584576 [ <Struct as Trait >:: Type { } ] ,
585577 "<Struct as Trait>::Type {}" ,
@@ -669,6 +661,12 @@ fn test_stmt() {
669661 c2 ! ( stmt, [ let _ ] , "let _;" , "let _" ) ;
670662 c2 ! ( stmt, [ let x = true ] , "let x = true;" , "let x = true" ) ;
671663 c2 ! ( stmt, [ let x: bool = true ] , "let x: bool = true;" , "let x : bool = true" ) ;
664+ c2 ! ( stmt, [ let ( a, b) = ( 1 , 2 ) ] , "let (a, b) = (1, 2);" , "let(a, b) = (1, 2)" ) ; // FIXME
665+ c2 ! ( stmt,
666+ [ let ( a, b) : ( u32 , u32 ) = ( 1 , 2 ) ] ,
667+ "let (a, b): (u32, u32) = (1, 2);" ,
668+ "let(a, b) : (u32, u32) = (1, 2)"
669+ ) ;
672670
673671 // StmtKind::Item
674672 c2 ! ( stmt, [ struct S ; ] , "struct S;" , "struct S ;" ) ;
@@ -705,14 +703,14 @@ fn test_ty() {
705703 c2 ! ( ty, [ & T ] , "&T" , "& T" ) ;
706704 c2 ! ( ty, [ & mut T ] , "&mut T" , "& mut T" ) ;
707705 c2 ! ( ty, [ & ' a T ] , "&'a T" , "& 'a T" ) ;
708- c2 ! ( ty, [ & ' a mut T ] , "&'a mut T" , "& 'a mut T" ) ;
706+ c2 ! ( ty, [ & ' a mut [ T ] ] , "&'a mut [T]" , "& 'a mut [T]" ) ;
707+ c2 ! ( ty, [ & A <B <C <D <E >>>> ] , "&A<B<C<D<E>>>>" , "& A < B < C < D < E >> >>" ) ;
709708
710709 // TyKind::BareFn
711710 c1 ! ( ty, [ fn ( ) ] , "fn()" ) ;
712711 c1 ! ( ty, [ fn ( ) -> ( ) ] , "fn() -> ()" ) ;
713712 c1 ! ( ty, [ fn ( u8 ) ] , "fn(u8)" ) ;
714713 c2 ! ( ty, [ fn ( x: u8 ) ] , "fn(x: u8)" , "fn(x : u8)" ) ;
715- #[ rustfmt:: skip]
716714 c2 ! ( ty, [ for <> fn ( ) ] , "fn()" , "for < > fn()" ) ;
717715 c2 ! ( ty, [ for <' a> fn ( ) ] , "for<'a> fn()" , "for < 'a > fn()" ) ;
718716
@@ -760,7 +758,7 @@ fn test_ty() {
760758
761759 // TyKind::Infer
762760 c1 ! ( ty, [ _ ] , "_" ) ;
763-
761+
764762 // TyKind::ImplicitSelf: there is no syntax for this.
765763
766764 // TyKind::MacCall
0 commit comments