@@ -163,11 +163,11 @@ pub fn render(
163
163
mod_items. extend ( w_impl_items) ;
164
164
165
165
mod_items. extend ( quote ! {
166
- #[ doc = "Writes raw bits to the register." ]
167
- pub unsafe fn bits( & mut self , bits: #rty) -> & mut Self {
168
- self . 0 . bits( bits) ;
169
- self
170
- }
166
+ #[ doc = "Writes raw bits to the register." ]
167
+ pub unsafe fn bits( & mut self , bits: #rty) -> & mut Self {
168
+ self . 0 . bits( bits) ;
169
+ self
170
+ }
171
171
} ) ;
172
172
173
173
close. to_tokens ( & mut mod_items) ;
@@ -465,35 +465,34 @@ pub fn fields(
465
465
466
466
if has_reserved_variant {
467
467
arms. extend ( quote ! {
468
- i => Res ( i) ,
469
- } ) ;
468
+ i => Res ( i) ,
469
+ } ) ;
470
470
} else if 1 << width. to_ty_width ( ) ? != variants. len ( ) {
471
471
arms. extend ( quote ! {
472
- _ => unreachable!( ) ,
473
- } ) ;
472
+ _ => unreachable!( ) ,
473
+ } ) ;
474
474
}
475
475
476
476
if has_reserved_variant {
477
477
enum_items. extend ( quote ! {
478
- ///Get enumerated values variant
479
- #inline
480
- pub fn variant( & self ) -> crate :: Variant <#fty, #name_pc_a> {
481
- use crate :: Variant :: * ;
482
- match self . bits {
483
- #arms
484
- }
485
- }
486
- } ) ;
478
+ ///Get enumerated values variant
479
+ #inline
480
+ pub fn variant( & self ) -> crate :: Variant <#fty, #name_pc_a> {
481
+ use crate :: Variant :: * ;
482
+ match self . bits {
483
+ #arms
484
+ }
485
+ }
486
+ } ) ;
487
487
} else {
488
488
enum_items. extend ( quote ! {
489
489
///Get enumerated values variant
490
490
#inline
491
491
pub fn variant( & self ) -> #name_pc_a {
492
- match self . bits {
493
- #arms
494
- }
495
- }
496
- } ) ;
492
+ match self . bits {
493
+ #arms
494
+ }
495
+ } } ) ;
497
496
}
498
497
499
498
for v in & variants {
@@ -511,12 +510,12 @@ pub fn fields(
511
510
512
511
let doc = format ! ( "Checks if the value of the field is `{}`" , pc) ;
513
512
enum_items. extend ( quote ! {
514
- #[ doc = #doc]
515
- #inline
516
- pub fn #is_variant( & self ) -> bool {
517
- * * self == #name_pc_a:: #pc
518
- }
519
- } ) ;
513
+ #[ doc = #doc]
514
+ #inline
515
+ pub fn #is_variant( & self ) -> bool {
516
+ * * self == #name_pc_a:: #pc
517
+ }
518
+ } ) ;
520
519
}
521
520
}
522
521
@@ -595,21 +594,19 @@ pub fn fields(
595
594
if !variants. is_empty ( ) {
596
595
if unsafety. is_some ( ) {
597
596
proxy_items. extend ( quote ! {
598
- ///Writes `variant` to the field
599
- #inline
600
- pub fn variant( self , variant: #name_pc_aw) -> & ' a mut W {
601
- unsafe {
602
- self . #bits( variant. into( ) )
597
+ ///Writes `variant` to the field
598
+ #inline
599
+ pub fn variant( self , variant: #name_pc_aw) -> & ' a mut W {
600
+ unsafe { self . #bits( variant. into( ) ) }
603
601
}
604
- }
605
602
} ) ;
606
603
} else {
607
604
proxy_items. extend ( quote ! {
608
- ///Writes `variant` to the field
609
- #inline
610
- pub fn variant( self , variant: #name_pc_aw) -> & ' a mut W {
611
- self . #bits( variant. into( ) )
612
- }
605
+ ///Writes `variant` to the field
606
+ #inline
607
+ pub fn variant( self , variant: #name_pc_aw) -> & ' a mut W {
608
+ self . #bits( variant. into( ) )
609
+ }
613
610
} ) ;
614
611
}
615
612
@@ -619,11 +616,11 @@ pub fn fields(
619
616
620
617
let doc = util:: escape_brackets ( util:: respace ( & v. doc ) . as_ref ( ) ) ;
621
618
proxy_items. extend ( quote ! {
622
- #[ doc = #doc]
623
- #inline
624
- pub fn #sc( self ) -> & ' a mut W {
625
- self . variant( #name_pc_aw:: #pc)
626
- }
619
+ #[ doc = #doc]
620
+ #inline
621
+ pub fn #sc( self ) -> & ' a mut W {
622
+ self . variant( #name_pc_aw:: #pc)
623
+ }
627
624
} ) ;
628
625
}
629
626
}
0 commit comments