@@ -264,9 +264,9 @@ fn print_type(&ps s, &ast::ty ty) {
264
264
fn print_item ( & ps s, & @ast:: item item) {
265
265
hardbreak ( s. s ) ;
266
266
maybe_print_comment ( s, item. span . lo ) ;
267
+ print_outer_attributes ( s, item. attrs ) ;
267
268
alt ( item. node ) {
268
269
case ( ast:: item_const ( ?ty, ?expr) ) {
269
- print_outer_attributes ( s, item. attrs ) ;
270
270
head ( s, "const" ) ;
271
271
print_type ( s, * ty) ;
272
272
space ( s. s ) ;
@@ -280,21 +280,19 @@ fn print_item(&ps s, &@ast::item item) {
280
280
281
281
}
282
282
case ( ast:: item_fn ( ?_fn, ?typarams) ) {
283
- print_outer_attributes ( s, item. attrs ) ;
284
283
print_fn ( s, _fn. decl , _fn. proto , item. ident , typarams) ;
285
284
word ( s. s , " " ) ;
286
285
print_block ( s, _fn. body ) ;
287
286
}
288
287
case ( ast:: item_mod ( ?_mod) ) {
289
- print_outer_attributes ( s, item. attrs ) ;
290
288
head ( s, "mod" ) ;
291
289
word_nbsp ( s, item. ident ) ;
292
290
bopen ( s) ;
291
+ print_inner_attributes ( s, item. attrs ) ;
293
292
for ( @ast:: item itm in _mod. items) { print_item ( s, itm) ; }
294
293
bclose ( s, item. span ) ;
295
294
}
296
295
case ( ast:: item_native_mod ( ?nmod) ) {
297
- print_outer_attributes ( s, item. attrs ) ;
298
296
head ( s, "native" ) ;
299
297
alt ( nmod. abi ) {
300
298
case ( ast:: native_abi_rust) { word_nbsp ( s, "\" rust\" " ) ; }
@@ -338,7 +336,6 @@ fn print_item(&ps s, &@ast::item item) {
338
336
bclose ( s, item. span ) ;
339
337
}
340
338
case ( ast:: item_ty ( ?ty, ?params) ) {
341
- print_outer_attributes ( s, item. attrs ) ;
342
339
ibox ( s, indent_unit) ;
343
340
ibox ( s, 0 u) ;
344
341
word_nbsp ( s, "type" ) ;
@@ -355,7 +352,6 @@ fn print_item(&ps s, &@ast::item item) {
355
352
break_offset ( s. s , 0 u, 0 ) ;
356
353
}
357
354
case ( ast:: item_tag ( ?variants, ?params) ) {
358
- print_outer_attributes ( s, item. attrs ) ;
359
355
head ( s, "tag" ) ;
360
356
word ( s. s , item. ident ) ;
361
357
print_type_params ( s, params) ;
@@ -379,7 +375,6 @@ fn print_item(&ps s, &@ast::item item) {
379
375
bclose ( s, item. span ) ;
380
376
}
381
377
case ( ast:: item_obj ( ?_obj, ?params, _) ) {
382
- print_outer_attributes ( s, item. attrs ) ;
383
378
head ( s, "obj" ) ;
384
379
word ( s. s , item. ident ) ;
385
380
print_type_params ( s, params) ;
@@ -438,6 +433,21 @@ fn print_outer_attributes(&ps s, vec[ast::attribute] attrs) {
438
433
if ( count > 0 ) { hardbreak ( s. s ) ; }
439
434
}
440
435
436
+ fn print_inner_attributes ( & ps s, vec[ ast:: attribute ] attrs ) {
437
+ auto count = 0 ;
438
+ for ( ast:: attribute attr in attrs) {
439
+ alt ( attr. node . style ) {
440
+ case ( ast:: attr_inner) {
441
+ print_attribute ( s, attr) ;
442
+ word ( s. s , ";" ) ;
443
+ count += 1 ;
444
+ }
445
+ case ( _) { /* fallthrough */ }
446
+ }
447
+ }
448
+ if ( count > 0 ) { hardbreak ( s. s ) ; }
449
+ }
450
+
441
451
fn print_attribute ( & ps s, & ast:: attribute attr) {
442
452
hardbreak ( s. s ) ;
443
453
maybe_print_comment ( s, attr. span . lo ) ;
0 commit comments