File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -499,15 +499,25 @@ pub fn fields(
499
499
}
500
500
}
501
501
502
- proxy_items. extend ( quote ! {
503
- ///Writes `variant` to the field
504
- #inline
505
- pub fn variant( self , variant: #pc_w) -> & ' a mut W {
506
- #unsafety {
507
- self . #bits( variant. into( ) )
502
+ if unsafety. is_some ( ) {
503
+ proxy_items. extend ( quote ! {
504
+ ///Writes `variant` to the field
505
+ #inline
506
+ pub fn variant( self , variant: #pc_w) -> & ' a mut W {
507
+ unsafe {
508
+ self . #bits( variant. into( ) )
509
+ }
508
510
}
509
- }
510
- } ) ;
511
+ } ) ;
512
+ } else {
513
+ proxy_items. extend ( quote ! {
514
+ ///Writes `variant` to the field
515
+ #inline
516
+ pub fn variant( self , variant: #pc_w) -> & ' a mut W {
517
+ self . #bits( variant. into( ) )
518
+ }
519
+ } ) ;
520
+ }
511
521
512
522
for v in & variants {
513
523
let pc = & v. pc ;
You can’t perform that action at this time.
0 commit comments