@@ -34,7 +34,7 @@ macro_rules! panic {
3434#[ cfg_attr( not( test) , rustc_diagnostic_item = "assert_eq_macro" ) ]
3535#[ allow_internal_unstable( core_panic) ]
3636macro_rules! assert_eq {
37- ( $left: expr, $right: expr $( , ) ?) => ( {
37+ ( $left: expr, $right: expr $( , ) ?) => {
3838 match ( & $left, & $right) {
3939 ( left_val, right_val) => {
4040 if !( * left_val == * right_val) {
@@ -46,8 +46,8 @@ macro_rules! assert_eq {
4646 }
4747 }
4848 }
49- } ) ;
50- ( $left: expr, $right: expr, $( $arg: tt) +) => ( {
49+ } ;
50+ ( $left: expr, $right: expr, $( $arg: tt) +) => {
5151 match ( & $left, & $right) {
5252 ( left_val, right_val) => {
5353 if !( * left_val == * right_val) {
@@ -59,7 +59,7 @@ macro_rules! assert_eq {
5959 }
6060 }
6161 }
62- } ) ;
62+ } ;
6363}
6464
6565/// Asserts that two expressions are not equal to each other (using [`PartialEq`]).
@@ -84,7 +84,7 @@ macro_rules! assert_eq {
8484#[ cfg_attr( not( test) , rustc_diagnostic_item = "assert_ne_macro" ) ]
8585#[ allow_internal_unstable( core_panic) ]
8686macro_rules! assert_ne {
87- ( $left: expr, $right: expr $( , ) ?) => ( {
87+ ( $left: expr, $right: expr $( , ) ?) => {
8888 match ( & $left, & $right) {
8989 ( left_val, right_val) => {
9090 if * left_val == * right_val {
@@ -96,8 +96,8 @@ macro_rules! assert_ne {
9696 }
9797 }
9898 }
99- } ) ;
100- ( $left: expr, $right: expr, $( $arg: tt) +) => ( {
99+ } ;
100+ ( $left: expr, $right: expr, $( $arg: tt) +) => {
101101 match ( & ( $left) , & ( $right) ) {
102102 ( left_val, right_val) => {
103103 if * left_val == * right_val {
@@ -109,7 +109,7 @@ macro_rules! assert_ne {
109109 }
110110 }
111111 }
112- } ) ;
112+ } ;
113113}
114114
115115/// Asserts that an expression matches any of the given patterns.
@@ -142,7 +142,7 @@ macro_rules! assert_ne {
142142#[ allow_internal_unstable( core_panic) ]
143143#[ rustc_macro_transparency = "semitransparent" ]
144144pub macro assert_matches {
145- ( $left: expr, $( |) ? $( $pattern: pat_param ) |+ $( if $guard: expr ) ? $( , ) ?) => ( {
145+ ( $left: expr, $( |) ? $( $pattern: pat_param ) |+ $( if $guard: expr ) ? $( , ) ?) => {
146146 match $left {
147147 $( $pattern ) |+ $( if $guard ) ? => { }
148148 ref left_val => {
@@ -153,8 +153,8 @@ pub macro assert_matches {
153153 ) ;
154154 }
155155 }
156- } ) ,
157- ( $left: expr, $( |) ? $( $pattern: pat_param ) |+ $( if $guard: expr ) ?, $( $arg: tt) +) => ( {
156+ } ,
157+ ( $left: expr, $( |) ? $( $pattern: pat_param ) |+ $( if $guard: expr ) ?, $( $arg: tt) +) => {
158158 match $left {
159159 $( $pattern ) |+ $( if $guard ) ? => { }
160160 ref left_val => {
@@ -165,7 +165,7 @@ pub macro assert_matches {
165165 ) ;
166166 }
167167 }
168- } ) ,
168+ } ,
169169}
170170
171171/// Asserts that a boolean expression is `true` at runtime.
@@ -214,7 +214,11 @@ pub macro assert_matches {
214214#[ rustc_diagnostic_item = "debug_assert_macro" ]
215215#[ allow_internal_unstable ( edition_panic) ]
216216macro_rules! debug_assert {
217- ( $( $arg: tt) * ) => ( if $crate:: cfg!( debug_assertions) { $crate:: assert!( $( $arg) * ) ; } )
217+ ( $( $arg: tt) * ) => {
218+ if $crate:: cfg!( debug_assertions) {
219+ $crate:: assert!( $( $arg) * ) ;
220+ }
221+ } ;
218222}
219223
220224/// Asserts that two expressions are equal to each other.
@@ -240,7 +244,11 @@ macro_rules! debug_assert {
240244#[ stable( feature = "rust1" , since = "1.0.0" ) ]
241245#[ cfg_attr( not( test) , rustc_diagnostic_item = "debug_assert_eq_macro" ) ]
242246macro_rules! debug_assert_eq {
243- ( $( $arg: tt) * ) => ( if $crate:: cfg!( debug_assertions) { $crate:: assert_eq!( $( $arg) * ) ; } )
247+ ( $( $arg: tt) * ) => {
248+ if $crate:: cfg!( debug_assertions) {
249+ $crate:: assert_eq!( $( $arg) * ) ;
250+ }
251+ } ;
244252}
245253
246254/// Asserts that two expressions are not equal to each other.
@@ -266,7 +274,11 @@ macro_rules! debug_assert_eq {
266274#[ stable( feature = "assert_ne" , since = "1.13.0" ) ]
267275#[ cfg_attr( not( test) , rustc_diagnostic_item = "debug_assert_ne_macro" ) ]
268276macro_rules! debug_assert_ne {
269- ( $( $arg: tt) * ) => ( if $crate :: cfg!( debug_assertions) { $crate :: assert_ne!( $( $arg) * ) ; } )
277+ ( $( $arg: tt) * ) => {
278+ if $crate:: cfg!( debug_assertions) {
279+ $crate:: assert_ne!( $( $arg) * ) ;
280+ }
281+ } ;
270282}
271283
272284/// Asserts that an expression matches any of the given patterns.
@@ -305,7 +317,9 @@ macro_rules! debug_assert_ne {
305317#[ allow_internal_unstable( assert_matches) ]
306318#[ rustc_macro_transparency = "semitransparent" ]
307319pub macro debug_assert_matches( $( $arg: tt) * ) {
308- if $crate :: cfg!( debug_assertions) { $crate :: assert_matches:: assert_matches!( $( $arg) * ) ; }
320+ if $crate:: cfg!( debug_assertions) {
321+ $crate:: assert_matches:: assert_matches!( $( $arg) * ) ;
322+ }
309323}
310324
311325/// Returns whether the given expression matches any of the given patterns.
@@ -331,7 +345,7 @@ macro_rules! matches {
331345 $( $pattern ) |+ $( if $guard ) ? => true ,
332346 _ => false
333347 }
334- }
348+ } ;
335349}
336350
337351/// Unwraps a result or propagates its error.
@@ -482,7 +496,9 @@ macro_rules! r#try {
482496#[ stable( feature = "rust1" , since = "1.0.0" ) ]
483497#[ cfg_attr( not( test) , rustc_diagnostic_item = "write_macro" ) ]
484498macro_rules! write {
485- ( $dst: expr, $( $arg: tt) * ) => ( $dst. write_fmt( $crate :: format_args!( $( $arg) * ) ) )
499+ ( $dst: expr, $( $arg: tt) * ) => {
500+ $dst. write_fmt( $crate:: format_args!( $( $arg) * ) )
501+ } ;
486502}
487503
488504/// Write formatted data into a buffer, with a newline appended.
@@ -534,12 +550,12 @@ macro_rules! write {
534550#[ cfg_attr( not( test) , rustc_diagnostic_item = "writeln_macro" ) ]
535551#[ allow_internal_unstable( format_args_nl) ]
536552macro_rules! writeln {
537- ( $dst: expr $( , ) ?) => (
553+ ( $dst: expr $( , ) ?) => {
538554 $crate:: write!( $dst, "\n " )
539- ) ;
540- ( $dst: expr, $( $arg: tt) * ) => (
555+ } ;
556+ ( $dst: expr, $( $arg: tt) * ) => {
541557 $dst. write_fmt( $crate:: format_args_nl!( $( $arg) * ) )
542- ) ;
558+ } ;
543559}
544560
545561/// Indicates unreachable code.
@@ -683,8 +699,12 @@ macro_rules! unreachable {
683699#[ cfg_attr( not( test) , rustc_diagnostic_item = "unimplemented_macro" ) ]
684700#[ allow_internal_unstable( core_panic) ]
685701macro_rules! unimplemented {
686- ( ) => ( $crate :: panicking:: panic( "not implemented" ) ) ;
687- ( $( $arg: tt) +) => ( $crate :: panic!( "not implemented: {}" , $crate :: format_args!( $( $arg) +) ) ) ;
702+ ( ) => {
703+ $crate:: panicking:: panic( "not implemented" )
704+ } ;
705+ ( $( $arg: tt) +) => {
706+ $crate:: panic!( "not implemented: {}" , $crate:: format_args!( $( $arg) +) )
707+ } ;
688708}
689709
690710/// Indicates unfinished code.
@@ -746,8 +766,12 @@ macro_rules! unimplemented {
746766#[ cfg_attr( not( test) , rustc_diagnostic_item = "todo_macro" ) ]
747767#[ allow_internal_unstable( core_panic) ]
748768macro_rules! todo {
749- ( ) => ( $crate :: panicking:: panic( "not yet implemented" ) ) ;
750- ( $( $arg: tt) +) => ( $crate :: panic!( "not yet implemented: {}" , $crate :: format_args!( $( $arg) +) ) ) ;
769+ ( ) => {
770+ $crate:: panicking:: panic( "not yet implemented" )
771+ } ;
772+ ( $( $arg: tt) +) => {
773+ $crate:: panic!( "not yet implemented: {}" , $crate:: format_args!( $( $arg) +) )
774+ } ;
751775}
752776
753777/// Definitions of built-in macros.
0 commit comments