@@ -552,12 +552,12 @@ impl Btf {
552552 } ;
553553
554554 match t. encoding {
555- btf:: BtfIntEncoding :: Signed => format ! ( "i{}" , width ) ,
555+ btf:: BtfIntEncoding :: Signed => format ! ( "i{width}" ) ,
556556 btf:: BtfIntEncoding :: Bool => {
557557 assert ! ( t. bits as usize == ( std:: mem:: size_of:: <bool >( ) * 8 ) ) ;
558558 "bool" . to_string ( )
559559 }
560- btf:: BtfIntEncoding :: Char | btf:: BtfIntEncoding :: None => format ! ( "u{}" , width ) ,
560+ btf:: BtfIntEncoding :: Char | btf:: BtfIntEncoding :: None => format ! ( "u{width}" ) ,
561561 }
562562 }
563563 BtfType :: Float ( t) => {
@@ -570,12 +570,12 @@ impl Btf {
570570 _ => bail ! ( "Invalid float width" ) ,
571571 } ;
572572
573- format ! ( "f{}" , width )
573+ format ! ( "f{width}" )
574574 }
575575 BtfType :: Ptr ( t) => {
576576 let pointee_ty = self . type_declaration ( t. pointee_type ) ?;
577577
578- format ! ( "*mut {}" , pointee_ty )
578+ format ! ( "*mut {pointee_ty}" )
579579 }
580580 BtfType :: Array ( t) => {
581581 let val_ty = self . type_declaration ( t. val_type_id ) ?;
@@ -832,16 +832,11 @@ impl Btf {
832832 ) ?;
833833
834834 if padding != 0 {
835- agg_content. push ( format ! (
836- r#" __pad_{offset}: [u8; {padding}],"# ,
837- offset = offset,
838- padding = padding,
839- ) ) ;
835+ agg_content
836+ . push ( format ! ( r#" __pad_{offset}: [u8; {padding}],"# , ) ) ;
840837
841838 impl_default. push ( format ! (
842839 r#" __pad_{offset}: [u8::default(); {padding}]"# ,
843- offset = offset,
844- padding = padding,
845840 ) ) ;
846841 }
847842
@@ -877,7 +872,7 @@ impl Btf {
877872 field_ty_str. clone ( )
878873 } ;
879874
880- agg_content. push ( format ! ( r#" pub {}: {},"# , field_name , field_ty_str ) ) ;
875+ agg_content. push ( format ! ( r#" pub {field_name }: {field_ty_str },"# ) ) ;
881876 }
882877
883878 if t. is_struct {
@@ -903,7 +898,7 @@ impl Btf {
903898 let aggregate_type = if t. is_struct { "struct" } else { "union" } ;
904899 let packed_repr = if packed { ", packed" } else { "" } ;
905900
906- writeln ! ( def, r#"#[repr(C{})]"# , packed_repr ) ?;
901+ writeln ! ( def, r#"#[repr(C{packed_repr })]"# ) ?;
907902 writeln ! (
908903 def,
909904 r#"pub {agg_type} {name} {{"# ,
@@ -912,7 +907,7 @@ impl Btf {
912907 ) ?;
913908
914909 for field in agg_content {
915- writeln ! ( def, "{}" , field ) ?;
910+ writeln ! ( def, "{field}" ) ?;
916911 }
917912 writeln ! ( def, "}}" ) ?;
918913
@@ -922,7 +917,7 @@ impl Btf {
922917 writeln ! ( def, r#" fn default() -> Self {{"# ) ?;
923918 writeln ! ( def, r#" {} {{"# , t. name) ?;
924919 for impl_def in impl_default {
925- writeln ! ( def, r#"{},"# , impl_def ) ?;
920+ writeln ! ( def, r#"{impl_def },"# ) ?;
926921 }
927922 writeln ! ( def, r#" }}"# ) ?;
928923 writeln ! ( def, r#" }}"# ) ?;
@@ -967,13 +962,8 @@ impl Btf {
967962 }
968963
969964 writeln ! ( def, r#"#[derive(Debug, Copy, Clone, PartialEq, Eq)]"# ) ?;
970- writeln ! (
971- def,
972- r#"#[repr({signed}{repr_size})]"# ,
973- signed = signed,
974- repr_size = repr_size,
975- ) ?;
976- writeln ! ( def, r#"pub enum {name} {{"# , name = t. name, ) ?;
965+ writeln ! ( def, r#"#[repr({signed}{repr_size})]"# ) ?;
966+ writeln ! ( def, r#"pub enum {name} {{"# , name = t. name) ?;
977967
978968 for value in & t. values {
979969 writeln ! (
@@ -1012,7 +1002,7 @@ impl Btf {
10121002
10131003 writeln ! ( def, r#"#[derive(Debug, Copy, Clone)]"# ) ?;
10141004 writeln ! ( def, r#"#[repr(C)]"# ) ?;
1015- writeln ! ( def, r#"pub struct {} {{"# , sec_name , ) ?;
1005+ writeln ! ( def, r#"pub struct {sec_name } {{"# ) ?;
10161006
10171007 let mut offset: u32 = 0 ;
10181008 for datasec_var in & t. vars {
@@ -1039,7 +1029,7 @@ impl Btf {
10391029 false ,
10401030 ) ?;
10411031 if padding != 0 {
1042- writeln ! ( def, r#" __pad_{}: [u8; {}],"# , offset , padding , ) ?;
1032+ writeln ! ( def, r#" __pad_{offset }: [u8; {padding }],"# ) ?;
10431033 }
10441034
10451035 // Set `offset` to end of current var
0 commit comments