@@ -662,36 +662,36 @@ impl C {
662662 match cast {
663663 Bitcast :: I32ToF32 | Bitcast :: I64ToF32 => {
664664 self . needs_union_int32_float = true ;
665- format ! ( "((union int32_float){{ (int32_t) {} }}).b" , op )
665+ format ! ( "((union int32_float){{ (int32_t) {op } }}).b" )
666666 }
667667 Bitcast :: F32ToI32 | Bitcast :: F32ToI64 => {
668668 self . needs_union_float_int32 = true ;
669- format ! ( "((union float_int32){{ {} }}).b" , op )
669+ format ! ( "((union float_int32){{ {op } }}).b" )
670670 }
671671 Bitcast :: I64ToF64 => {
672672 self . needs_union_int64_double = true ;
673- format ! ( "((union int64_double){{ (int64_t) {} }}).b" , op )
673+ format ! ( "((union int64_double){{ (int64_t) {op } }}).b" )
674674 }
675675 Bitcast :: F64ToI64 => {
676676 self . needs_union_double_int64 = true ;
677- format ! ( "((union double_int64){{ {} }}).b" , op )
677+ format ! ( "((union double_int64){{ {op } }}).b" )
678678 }
679679 Bitcast :: I32ToI64 | Bitcast :: LToI64 | Bitcast :: PToP64 => {
680- format ! ( "(int64_t) {}" , op )
680+ format ! ( "(int64_t) {op}" )
681681 }
682682 Bitcast :: I64ToI32 | Bitcast :: I64ToL => {
683- format ! ( "(int32_t) {}" , op )
683+ format ! ( "(int32_t) {op}" )
684684 }
685685 // P64 is currently represented as int64_t, so no conversion is needed.
686686 Bitcast :: I64ToP64 | Bitcast :: P64ToI64 => {
687- format ! ( "{}" , op )
687+ format ! ( "{op}" )
688688 }
689689 Bitcast :: P64ToP | Bitcast :: I32ToP | Bitcast :: LToP => {
690- format ! ( "(uint8_t *) {}" , op )
690+ format ! ( "(uint8_t *) {op}" )
691691 }
692692
693693 // Cast to uintptr_t to avoid implicit pointer-to-int conversions.
694- Bitcast :: PToI32 | Bitcast :: PToL => format ! ( "(uintptr_t) {}" , op ) ,
694+ Bitcast :: PToI32 | Bitcast :: PToL => format ! ( "(uintptr_t) {op}" ) ,
695695
696696 Bitcast :: I32ToL | Bitcast :: LToI32 | Bitcast :: None => op. to_string ( ) ,
697697
@@ -2034,7 +2034,7 @@ impl InterfaceGenerator<'_> {
20342034 let mut f = FunctionBindgen :: new ( self , c_sig, & import_name) ;
20352035 for ( pointer, param) in f. sig . params . iter ( ) {
20362036 if * pointer {
2037- f. params . push ( format ! ( "*{}" , param ) ) ;
2037+ f. params . push ( format ! ( "*{param}" ) ) ;
20382038 } else {
20392039 f. params . push ( param. clone ( ) ) ;
20402040 }
@@ -2332,7 +2332,7 @@ void {name}_return({return_ty}) {{
23322332 } else if single_ret {
23332333 "ret" . into ( )
23342334 } else {
2335- format ! ( "ret{}" , i )
2335+ format ! ( "ret{i}" )
23362336 } ;
23372337 self . src . h_fns ( & name) ;
23382338 retptrs. push ( name) ;
@@ -2897,7 +2897,7 @@ impl<'a, 'b> FunctionBindgen<'a, 'b> {
28972897 ) {
28982898 self . load ( ty, offset, operands, results) ;
28992899 let result = results. pop ( ) . unwrap ( ) ;
2900- results. push ( format ! ( "(int32_t) {}" , result ) ) ;
2900+ results. push ( format ! ( "(int32_t) {result}" ) ) ;
29012901 }
29022902
29032903 fn store ( & mut self , ty : & str , offset : ArchitectureSize , operands : & [ String ] ) {
@@ -2930,10 +2930,7 @@ impl<'a, 'b> FunctionBindgen<'a, 'b> {
29302930 && self . r#gen . autodrop_enabled ( )
29312931 && self . r#gen . contains_droppable_borrow ( ty)
29322932 {
2933- panic ! (
2934- "Unable to autodrop borrows in `{}` values, please disable autodrop" ,
2935- context
2936- )
2933+ panic ! ( "Unable to autodrop borrows in `{context}` values, please disable autodrop" )
29372934 }
29382935 }
29392936}
@@ -3055,7 +3052,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
30553052 }
30563053 Instruction :: RecordLift { ty, record, .. } => {
30573054 let name = self . r#gen . r#gen . type_name ( & Type :: Id ( * ty) ) ;
3058- let mut result = format ! ( "({}) {{\n " , name ) ;
3055+ let mut result = format ! ( "({name }) {{\n " ) ;
30593056 for ( field, op) in record. fields . iter ( ) . zip ( operands. iter ( ) ) {
30603057 let field_ty = self . r#gen . r#gen . type_name ( & field. ty ) ;
30613058 uwriteln ! ( result, "({}) {}," , field_ty, op) ;
@@ -3067,12 +3064,12 @@ impl Bindgen for FunctionBindgen<'_, '_> {
30673064 Instruction :: TupleLower { tuple, .. } => {
30683065 let op = & operands[ 0 ] ;
30693066 for i in 0 ..tuple. types . len ( ) {
3070- results. push ( format ! ( "({}).f{}" , op , i ) ) ;
3067+ results. push ( format ! ( "({op }).f{i}" ) ) ;
30713068 }
30723069 }
30733070 Instruction :: TupleLift { ty, tuple, .. } => {
30743071 let name = self . r#gen . r#gen . type_name ( & Type :: Id ( * ty) ) ;
3075- let mut result = format ! ( "({}) {{\n " , name ) ;
3072+ let mut result = format ! ( "({name }) {{\n " ) ;
30763073 for ( ty, op) in tuple. types . iter ( ) . zip ( operands. iter ( ) ) {
30773074 let ty = self . r#gen . r#gen . type_name ( & ty) ;
30783075 uwriteln ! ( result, "({}) {}," , ty, op) ;
@@ -3151,7 +3148,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
31513148
31523149 Instruction :: VariantPayloadName => {
31533150 let name = self . locals . tmp ( "payload" ) ;
3154- results. push ( format ! ( "*{}" , name ) ) ;
3151+ results. push ( format ! ( "*{name}" ) ) ;
31553152 self . payloads . push ( name) ;
31563153 }
31573154
@@ -3229,7 +3226,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
32293226 assert ! ( block_results. len( ) == ( case. ty. is_some( ) as usize ) ) ;
32303227
32313228 if let Some ( _) = case. ty . as_ref ( ) {
3232- let mut dst = format ! ( "{}.val" , result ) ;
3229+ let mut dst = format ! ( "{result }.val" ) ;
32333230 dst. push_str ( "." ) ;
32343231 dst. push_str ( & to_c_ident ( & case. name ) ) ;
32353232 self . store_op ( & block_results[ 0 ] , & dst) ;
@@ -3665,7 +3662,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
36653662 Some ( Scalar :: OptionBool ( _) ) => {
36663663 assert_eq ! ( operands. len( ) , 1 ) ;
36673664 let variant = & operands[ 0 ] ;
3668- self . store_in_retptr ( & format ! ( "{}.val" , variant ) ) ;
3665+ self . store_in_retptr ( & format ! ( "{variant }.val" ) ) ;
36693666 self . src . push_str ( "return " ) ;
36703667 self . src . push_str ( & variant) ;
36713668 self . src . push_str ( ".is_some;\n " ) ;
@@ -3677,7 +3674,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
36773674 uwriteln ! ( self . src, "if (!{}.is_err) {{" , variant) ;
36783675 if ok. is_some ( ) {
36793676 if ok. is_some ( ) {
3680- self . store_in_retptr ( & format ! ( "{}.val.ok" , variant ) ) ;
3677+ self . store_in_retptr ( & format ! ( "{variant }.val.ok" ) ) ;
36813678 } else {
36823679 self . empty_return_value ( ) ;
36833680 }
@@ -3689,7 +3686,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
36893686 ) ;
36903687 if err. is_some ( ) {
36913688 if err. is_some ( ) {
3692- self . store_in_retptr ( & format ! ( "{}.val.err" , variant ) ) ;
3689+ self . store_in_retptr ( & format ! ( "{variant }.val.err" ) ) ;
36933690 } else {
36943691 self . empty_return_value ( ) ;
36953692 }
@@ -3797,7 +3794,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
37973794 }
37983795
37993796 Instruction :: Flush { amt } => {
3800- results. extend ( operands. iter ( ) . take ( * amt) . map ( |v| v . clone ( ) ) ) ;
3797+ results. extend ( operands. iter ( ) . take ( * amt) . cloned ( ) ) ;
38013798 }
38023799
38033800 Instruction :: AsyncTaskReturn { name, params } => {
@@ -3815,7 +3812,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
38153812 params : params
38163813 . iter ( )
38173814 . zip ( operands)
3818- . map ( |( a, b) | ( a . clone ( ) , b. clone ( ) ) )
3815+ . map ( |( a, b) | ( * a , b. clone ( ) ) )
38193816 . collect ( ) ,
38203817 } ;
38213818 }
@@ -3928,7 +3925,7 @@ pub fn flags_repr(f: &Flags) -> Int {
39283925 FlagsRepr :: U16 => Int :: U16 ,
39293926 FlagsRepr :: U32 ( 1 ) => Int :: U32 ,
39303927 FlagsRepr :: U32 ( 2 ) => Int :: U64 ,
3931- repr => panic ! ( "unimplemented flags {:?}" , repr ) ,
3928+ repr => panic ! ( "unimplemented flags {repr :?}" ) ,
39323929 }
39333930}
39343931
0 commit comments