@@ -126,8 +126,20 @@ fn span_root() {
126126 span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , Level :: TRACE , "foo" , bar. baz = 2 , quux = 4 , ) ;
127127 span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , Level :: TRACE , "foo" ) ;
128128 span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , Level :: TRACE , "bar" , ) ;
129- span ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "foo" , bar. baz = 2 , quux = 3 ) ;
130- span ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "foo" , bar. baz = 2 , quux = 4 , ) ;
129+ span ! (
130+ parent: :: core:: option:: Option :: None ,
131+ Level :: DEBUG ,
132+ "foo" ,
133+ bar. baz = 2 ,
134+ quux = 3
135+ ) ;
136+ span ! (
137+ parent: :: core:: option:: Option :: None ,
138+ Level :: DEBUG ,
139+ "foo" ,
140+ bar. baz = 2 ,
141+ quux = 4 ,
142+ ) ;
131143 span ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "foo" ) ;
132144 span ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "bar" , ) ;
133145}
@@ -139,8 +151,18 @@ fn trace_span_root() {
139151 trace_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
140152 trace_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" ) ;
141153 trace_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "bar" , ) ;
142- trace_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 3 ) ;
143- trace_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
154+ trace_span ! (
155+ parent: :: core:: option:: Option :: None ,
156+ "foo" ,
157+ bar. baz = 2 ,
158+ quux = 3
159+ ) ;
160+ trace_span ! (
161+ parent: :: core:: option:: Option :: None ,
162+ "foo" ,
163+ bar. baz = 2 ,
164+ quux = 4 ,
165+ ) ;
144166 trace_span ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
145167 trace_span ! ( parent: :: core:: option:: Option :: None , "bar" , ) ;
146168}
@@ -152,8 +174,18 @@ fn debug_span_root() {
152174 debug_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
153175 debug_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" ) ;
154176 debug_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "bar" , ) ;
155- debug_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 3 ) ;
156- debug_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
177+ debug_span ! (
178+ parent: :: core:: option:: Option :: None ,
179+ "foo" ,
180+ bar. baz = 2 ,
181+ quux = 3
182+ ) ;
183+ debug_span ! (
184+ parent: :: core:: option:: Option :: None ,
185+ "foo" ,
186+ bar. baz = 2 ,
187+ quux = 4 ,
188+ ) ;
157189 debug_span ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
158190 debug_span ! ( parent: :: core:: option:: Option :: None , "bar" , ) ;
159191}
@@ -165,8 +197,18 @@ fn info_span_root() {
165197 info_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
166198 info_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" ) ;
167199 info_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "bar" , ) ;
168- info_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 3 ) ;
169- info_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
200+ info_span ! (
201+ parent: :: core:: option:: Option :: None ,
202+ "foo" ,
203+ bar. baz = 2 ,
204+ quux = 3
205+ ) ;
206+ info_span ! (
207+ parent: :: core:: option:: Option :: None ,
208+ "foo" ,
209+ bar. baz = 2 ,
210+ quux = 4 ,
211+ ) ;
170212 info_span ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
171213 info_span ! ( parent: :: core:: option:: Option :: None , "bar" , ) ;
172214}
@@ -178,8 +220,18 @@ fn warn_span_root() {
178220 warn_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
179221 warn_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" ) ;
180222 warn_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "bar" , ) ;
181- warn_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 3 ) ;
182- warn_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
223+ warn_span ! (
224+ parent: :: core:: option:: Option :: None ,
225+ "foo" ,
226+ bar. baz = 2 ,
227+ quux = 3
228+ ) ;
229+ warn_span ! (
230+ parent: :: core:: option:: Option :: None ,
231+ "foo" ,
232+ bar. baz = 2 ,
233+ quux = 4 ,
234+ ) ;
183235 warn_span ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
184236 warn_span ! ( parent: :: core:: option:: Option :: None , "bar" , ) ;
185237}
@@ -191,8 +243,18 @@ fn error_span_root() {
191243 error_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
192244 error_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "foo" ) ;
193245 error_span ! ( target: "foo_events" , parent: :: core:: option:: Option :: None , "bar" , ) ;
194- error_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 3 ) ;
195- error_span ! ( parent: :: core:: option:: Option :: None , "foo" , bar. baz = 2 , quux = 4 , ) ;
246+ error_span ! (
247+ parent: :: core:: option:: Option :: None ,
248+ "foo" ,
249+ bar. baz = 2 ,
250+ quux = 3
251+ ) ;
252+ error_span ! (
253+ parent: :: core:: option:: Option :: None ,
254+ "foo" ,
255+ bar. baz = 2 ,
256+ quux = 4 ,
257+ ) ;
196258 error_span ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
197259 error_span ! ( parent: :: core:: option:: Option :: None , "bar" , ) ;
198260}
@@ -712,9 +774,19 @@ fn event_root() {
712774 bar. baz = 2 ,
713775 quux = false
714776 ) ;
715- event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , foo = 3 , bar. baz = 3 , ) ;
777+ event ! (
778+ parent: :: core:: option:: Option :: None ,
779+ Level :: DEBUG ,
780+ foo = 3 ,
781+ bar. baz = 3 ,
782+ ) ;
716783 event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "foo" ) ;
717- event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , "foo: {}" , 3 ) ;
784+ event ! (
785+ parent: :: core:: option:: Option :: None ,
786+ Level :: DEBUG ,
787+ "foo: {}" ,
788+ 3
789+ ) ;
718790 event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , { foo = 3 , bar. baz = 80 } , "quux" ) ;
719791 event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , { foo = 2 , bar. baz = 79 } , "quux {:?}" , true ) ;
720792 event ! ( parent: :: core:: option:: Option :: None , Level :: DEBUG , { foo = 2 , bar. baz = 79 } , "quux {:?}, {quux}" , true , quux = false ) ;
@@ -741,7 +813,12 @@ fn event_root() {
741813#[ test]
742814fn trace_root ( ) {
743815 trace ! ( parent: :: core:: option:: Option :: None , foo = ?3 , bar. baz = %2 , quux = false ) ;
744- trace ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 2 , quux = false ) ;
816+ trace ! (
817+ parent: :: core:: option:: Option :: None ,
818+ foo = 3 ,
819+ bar. baz = 2 ,
820+ quux = false
821+ ) ;
745822 trace ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 3 , ) ;
746823 trace ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
747824 trace ! ( parent: :: core:: option:: Option :: None , "foo: {}" , 3 ) ;
@@ -772,7 +849,12 @@ fn trace_root() {
772849#[ test]
773850fn debug_root ( ) {
774851 debug ! ( parent: :: core:: option:: Option :: None , foo = ?3 , bar. baz = %2 , quux = false ) ;
775- debug ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 2 , quux = false ) ;
852+ debug ! (
853+ parent: :: core:: option:: Option :: None ,
854+ foo = 3 ,
855+ bar. baz = 2 ,
856+ quux = false
857+ ) ;
776858 debug ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 3 , ) ;
777859 debug ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
778860 debug ! ( parent: :: core:: option:: Option :: None , "foo: {}" , 3 ) ;
@@ -803,7 +885,12 @@ fn debug_root() {
803885#[ test]
804886fn info_root ( ) {
805887 info ! ( parent: :: core:: option:: Option :: None , foo = ?3 , bar. baz = %2 , quux = false ) ;
806- info ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 2 , quux = false ) ;
888+ info ! (
889+ parent: :: core:: option:: Option :: None ,
890+ foo = 3 ,
891+ bar. baz = 2 ,
892+ quux = false
893+ ) ;
807894 info ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 3 , ) ;
808895 info ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
809896 info ! ( parent: :: core:: option:: Option :: None , "foo: {}" , 3 ) ;
@@ -834,7 +921,12 @@ fn info_root() {
834921#[ test]
835922fn warn_root ( ) {
836923 warn ! ( parent: :: core:: option:: Option :: None , foo = ?3 , bar. baz = %2 , quux = false ) ;
837- warn ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 2 , quux = false ) ;
924+ warn ! (
925+ parent: :: core:: option:: Option :: None ,
926+ foo = 3 ,
927+ bar. baz = 2 ,
928+ quux = false
929+ ) ;
838930 warn ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 3 , ) ;
839931 warn ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
840932 warn ! ( parent: :: core:: option:: Option :: None , "foo: {}" , 3 ) ;
@@ -865,7 +957,12 @@ fn warn_root() {
865957#[ test]
866958fn error_root ( ) {
867959 error ! ( parent: :: core:: option:: Option :: None , foo = ?3 , bar. baz = %2 , quux = false ) ;
868- error ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 2 , quux = false ) ;
960+ error ! (
961+ parent: :: core:: option:: Option :: None ,
962+ foo = 3 ,
963+ bar. baz = 2 ,
964+ quux = false
965+ ) ;
869966 error ! ( parent: :: core:: option:: Option :: None , foo = 3 , bar. baz = 3 , ) ;
870967 error ! ( parent: :: core:: option:: Option :: None , "foo" ) ;
871968 error ! ( parent: :: core:: option:: Option :: None , "foo: {}" , 3 ) ;
@@ -1156,3 +1253,19 @@ fn callsite_macro_api() {
11561253 fields: foo,
11571254 } ;
11581255}
1256+
1257+ #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen_test:: wasm_bindgen_test) ]
1258+ #[ test]
1259+ fn format_args_already_defined ( ) {
1260+ // Reproduces: https://github.com/tokio-rs/tracing/issues/2721
1261+ #[ allow( unused) ]
1262+ macro_rules! format_args {
1263+ ( $i: expr) => { } ;
1264+ }
1265+ event ! ( Level :: DEBUG , "foo: {}" , 3 ) ;
1266+ trace ! ( "foo: {}" , 3 ) ;
1267+ debug ! ( "foo: {}" , 3 ) ;
1268+ info ! ( "foo: {}" , 3 ) ;
1269+ warn ! ( "foo: {}" , 3 ) ;
1270+ error ! ( "foo: {}" , 3 ) ;
1271+ }
0 commit comments