Skip to content

Commit b9d9a49

Browse files
committed
Get rid of a boatload of unnecessary braces errors
``` warning: unnecessary braces around block return value --> src/lib.rs:22188:62 | 22188 | pub fn variant ( self , variant : HSEBYP_A ) -> & 'a mut W { { self . bit ( variant . into ( ) ) } } # [ doc = "HSE crystal oscillator not bypassed" ] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these braces ``` Signed-off-by: Daniel Egger <[email protected]>
1 parent 714ed98 commit b9d9a49

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/generate/register.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,25 @@ pub fn fields(
499499
}
500500
}
501501

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+
}
508510
}
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+
}
511521

512522
for v in &variants {
513523
let pc = &v.pc;

0 commit comments

Comments
 (0)