@@ -229,13 +229,11 @@ pub fn render(
229229 . iter ( )
230230 . map ( |s| format ! ( "[`{0}`](crate::generic::Reg::{0})" , s) )
231231 . collect :: < Vec < _ > > ( ) ;
232- let mut doc = format ! ( "{}\n \n This register you can {}. See [API](https://docs.rs/svd2rust/#read--modify--write-api)." ,
233- & description, methods. join( ", " ) ) ;
232+ let mut doc = format ! ( "{description}\n \n This register you can {}. See [API](https://docs.rs/svd2rust/#read--modify--write-api)." , methods. join( ", " ) ) ;
234233
235234 if name_snake_case != "cfg" {
236235 doc += format ! (
237- "\n \n For information about available fields see [{0}](index.html) module" ,
238- & name_snake_case
236+ "\n \n For information about available fields see [{name_snake_case}](index.html) module"
239237 )
240238 . as_str ( ) ;
241239 }
@@ -251,10 +249,8 @@ pub fn render(
251249 }
252250 }
253251
254- let alias_doc = format ! (
255- "{} register accessor: an alias for `Reg<{}>`" ,
256- name, name_constant_case_spec,
257- ) ;
252+ let alias_doc =
253+ format ! ( "{name} register accessor: an alias for `Reg<{name_constant_case_spec}>`" ) ;
258254 out. extend ( quote ! {
259255 #[ doc = #alias_doc]
260256 pub type #name_constant_case = crate :: Reg <#name_snake_case:: #name_constant_case_spec>;
@@ -269,10 +265,7 @@ pub fn render(
269265 } ) ;
270266
271267 if can_read {
272- let doc = format ! (
273- "`read()` method returns [{0}::R](R) reader structure" ,
274- & name_snake_case
275- ) ;
268+ let doc = format ! ( "`read()` method returns [{name_snake_case}::R](R) reader structure" , ) ;
276269 mod_items. extend ( quote ! {
277270 #[ doc = #doc]
278271 impl crate :: Readable for #name_constant_case_spec {
@@ -281,10 +274,8 @@ pub fn render(
281274 } ) ;
282275 }
283276 if can_write {
284- let doc = format ! (
285- "`write(|w| ..)` method takes [{0}::W](W) writer structure" ,
286- & name_snake_case
287- ) ;
277+ let doc =
278+ format ! ( "`write(|w| ..)` method takes [{name_snake_case}::W](W) writer structure" , ) ;
288279 mod_items. extend ( quote ! {
289280 #[ doc = #doc]
290281 impl crate :: Writable for #name_constant_case_spec {
@@ -293,7 +284,7 @@ pub fn render(
293284 } ) ;
294285 }
295286 if let Some ( rv) = properties. reset_value . map ( util:: hex) {
296- let doc = format ! ( "`reset()` method sets {} to value {}" , register. name, & rv ) ;
287+ let doc = format ! ( "`reset()` method sets {} to value {rv }" , register. name) ;
297288 mod_items. extend ( quote ! {
298289 #[ doc = #doc]
299290 impl crate :: Resettable for #name_constant_case_spec {
@@ -416,7 +407,7 @@ pub fn fields(
416407 0
417408 } ;
418409 let suffixes: Vec < _ > = de. indexes ( ) . collect ( ) ;
419- let suffixes_str = format ! ( "({}-{})" , first , first + de. dim - 1 ) ;
410+ let suffixes_str = format ! ( "({first }-{})" , first + de. dim - 1 ) ;
420411 Some ( ( first, de. dim , de. dim_increment , suffixes, suffixes_str) )
421412 }
422413 Field :: Single ( _) => {
@@ -453,12 +444,11 @@ pub fn fields(
453444 // the suffix string from field name is removed in brief description.
454445 let field_reader_brief = if let Some ( ( _, _, _, _, suffixes_str) ) = & field_dim {
455446 format ! (
456- "Fields `{}` reader - {}" ,
447+ "Fields `{}` reader - {description }" ,
457448 util:: replace_suffix( & f. name, suffixes_str) ,
458- description,
459449 )
460450 } else {
461- format ! ( "Field `{}` reader - {}" , f. name, description )
451+ format ! ( "Field `{}` reader - {description }" , f. name)
462452 } ;
463453
464454 // get the type of value structure. It can be generated from either name field
@@ -468,11 +458,11 @@ pub fn fields(
468458 if let Some ( enum_name) = & evs. name {
469459 let enum_name_constant_case = enum_name. to_sanitized_constant_case ( ) ;
470460 let enum_value_read_ty =
471- Ident :: new ( & format ! ( "{}_A" , enum_name_constant_case ) , span) ;
461+ Ident :: new ( & format ! ( "{enum_name_constant_case }_A" ) , span) ;
472462 enum_value_read_ty
473463 } else {
474464 let derived_field_value_read_ty =
475- Ident :: new ( & format ! ( "{}_A" , name_constant_case ) , span) ;
465+ Ident :: new ( & format ! ( "{name_constant_case }_A" ) , span) ;
476466 derived_field_value_read_ty
477467 }
478468 } else {
@@ -604,14 +594,14 @@ pub fn fields(
604594
605595 let is_variant = Ident :: new (
606596 & if sc. to_string ( ) . starts_with ( '_' ) {
607- format ! ( "is{}" , sc )
597+ format ! ( "is{sc}" )
608598 } else {
609- format ! ( "is_{}" , sc )
599+ format ! ( "is_{sc}" )
610600 } ,
611601 span,
612602 ) ;
613603
614- let doc = format ! ( "Checks if the value of the field is `{}`" , pc ) ;
604+ let doc = format ! ( "Checks if the value of the field is `{pc }`" ) ;
615605 enum_items. extend ( quote ! {
616606 #[ doc = #doc]
617607 #inline
@@ -735,12 +725,11 @@ pub fn fields(
735725 // gets a brief of write proxy
736726 let field_writer_brief = if let Some ( ( _, _, _, _, suffixes_str) ) = & field_dim {
737727 format ! (
738- "Fields `{}` writer - {}" ,
728+ "Fields `{}` writer - {description }" ,
739729 util:: replace_suffix( & f. name, suffixes_str) ,
740- description,
741730 )
742731 } else {
743- format ! ( "Field `{}` writer - {}" , f. name, description )
732+ format ! ( "Field `{}` writer - {description }" , f. name)
744733 } ;
745734
746735 let value_write_ty =
@@ -754,11 +743,11 @@ pub fn fields(
754743 if let Some ( enum_name) = & evs. name {
755744 let enum_name_constant_case = enum_name. to_sanitized_constant_case ( ) ;
756745 let enum_value_write_ty =
757- Ident :: new ( & format ! ( "{}_{}" , enum_name_constant_case , ty_suffix ) , span) ;
746+ Ident :: new ( & format ! ( "{enum_name_constant_case }_{ty_suffix}" ) , span) ;
758747 enum_value_write_ty
759748 } else {
760749 let derived_field_value_write_ty =
761- Ident :: new ( & format ! ( "{}_{}" , name_constant_case , ty_suffix ) , span) ;
750+ Ident :: new ( & format ! ( "{name_constant_case }_{ty_suffix}" ) , span) ;
762751 derived_field_value_write_ty
763752 }
764753 } else {
@@ -1007,7 +996,7 @@ impl Variant {
1007996 doc : ev
1008997 . description
1009998 . clone ( )
1010- . unwrap_or_else ( || format ! ( "`{:b}`" , value ) ) ,
999+ . unwrap_or_else ( || format ! ( "`{value :b}`" ) ) ,
10111000 pc : Ident :: new (
10121001 & ( if pc {
10131002 ev. name . to_sanitized_pascal_case ( )
@@ -1039,9 +1028,9 @@ fn add_with_no_variants(
10391028 } ;
10401029
10411030 let desc = if let Some ( rv) = reset_value {
1042- format ! ( "{}\n \n Value on reset: {}" , desc , rv )
1031+ format ! ( "{desc }\n \n Value on reset: {rv}" )
10431032 } else {
1044- desc. to_owned ( )
1033+ desc. to_string ( )
10451034 } ;
10461035
10471036 mod_items. extend ( quote ! {
@@ -1085,9 +1074,9 @@ fn add_from_variants(
10851074 }
10861075
10871076 let desc = if let Some ( rv) = reset_value {
1088- format ! ( "{}\n \n Value on reset: {}" , desc , rv )
1077+ format ! ( "{desc }\n \n Value on reset: {rv}" )
10891078 } else {
1090- desc. to_owned ( )
1079+ desc. to_string ( )
10911080 } ;
10921081
10931082 mod_items. extend ( quote ! {
@@ -1140,9 +1129,9 @@ fn calculate_offset(
11401129
11411130fn description_with_bits ( description : & str , offset : u64 , width : u32 ) -> String {
11421131 let mut res = if width == 1 {
1143- format ! ( "Bit {}" , offset )
1132+ format ! ( "Bit {offset}" )
11441133 } else {
1145- format ! ( "Bits {}:{}" , offset , offset + width as u64 - 1 )
1134+ format ! ( "Bits {offset }:{}" , offset + width as u64 - 1 )
11461135 } ;
11471136 if !description. is_empty ( ) {
11481137 res. push_str ( " - " ) ;
0 commit comments