@@ -229,13 +229,11 @@ pub fn render(
229
229
. iter ( )
230
230
. map ( |s| format ! ( "[`{0}`](crate::generic::Reg::{0})" , s) )
231
231
. 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( ", " ) ) ;
234
233
235
234
if name_snake_case != "cfg" {
236
235
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"
239
237
)
240
238
. as_str ( ) ;
241
239
}
@@ -251,10 +249,8 @@ pub fn render(
251
249
}
252
250
}
253
251
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}>`" ) ;
258
254
out. extend ( quote ! {
259
255
#[ doc = #alias_doc]
260
256
pub type #name_constant_case = crate :: Reg <#name_snake_case:: #name_constant_case_spec>;
@@ -269,10 +265,7 @@ pub fn render(
269
265
} ) ;
270
266
271
267
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" , ) ;
276
269
mod_items. extend ( quote ! {
277
270
#[ doc = #doc]
278
271
impl crate :: Readable for #name_constant_case_spec {
@@ -281,10 +274,8 @@ pub fn render(
281
274
} ) ;
282
275
}
283
276
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" , ) ;
288
279
mod_items. extend ( quote ! {
289
280
#[ doc = #doc]
290
281
impl crate :: Writable for #name_constant_case_spec {
@@ -293,7 +284,7 @@ pub fn render(
293
284
} ) ;
294
285
}
295
286
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) ;
297
288
mod_items. extend ( quote ! {
298
289
#[ doc = #doc]
299
290
impl crate :: Resettable for #name_constant_case_spec {
@@ -416,7 +407,7 @@ pub fn fields(
416
407
0
417
408
} ;
418
409
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 ) ;
420
411
Some ( ( first, de. dim , de. dim_increment , suffixes, suffixes_str) )
421
412
}
422
413
Field :: Single ( _) => {
@@ -453,12 +444,11 @@ pub fn fields(
453
444
// the suffix string from field name is removed in brief description.
454
445
let field_reader_brief = if let Some ( ( _, _, _, _, suffixes_str) ) = & field_dim {
455
446
format ! (
456
- "Fields `{}` reader - {}" ,
447
+ "Fields `{}` reader - {description }" ,
457
448
util:: replace_suffix( & f. name, suffixes_str) ,
458
- description,
459
449
)
460
450
} else {
461
- format ! ( "Field `{}` reader - {}" , f. name, description )
451
+ format ! ( "Field `{}` reader - {description }" , f. name)
462
452
} ;
463
453
464
454
// get the type of value structure. It can be generated from either name field
@@ -468,11 +458,11 @@ pub fn fields(
468
458
if let Some ( enum_name) = & evs. name {
469
459
let enum_name_constant_case = enum_name. to_sanitized_constant_case ( ) ;
470
460
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) ;
472
462
enum_value_read_ty
473
463
} else {
474
464
let derived_field_value_read_ty =
475
- Ident :: new ( & format ! ( "{}_A" , name_constant_case ) , span) ;
465
+ Ident :: new ( & format ! ( "{name_constant_case }_A" ) , span) ;
476
466
derived_field_value_read_ty
477
467
}
478
468
} else {
@@ -604,14 +594,14 @@ pub fn fields(
604
594
605
595
let is_variant = Ident :: new (
606
596
& if sc. to_string ( ) . starts_with ( '_' ) {
607
- format ! ( "is{}" , sc )
597
+ format ! ( "is{sc}" )
608
598
} else {
609
- format ! ( "is_{}" , sc )
599
+ format ! ( "is_{sc}" )
610
600
} ,
611
601
span,
612
602
) ;
613
603
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 }`" ) ;
615
605
enum_items. extend ( quote ! {
616
606
#[ doc = #doc]
617
607
#inline
@@ -735,12 +725,11 @@ pub fn fields(
735
725
// gets a brief of write proxy
736
726
let field_writer_brief = if let Some ( ( _, _, _, _, suffixes_str) ) = & field_dim {
737
727
format ! (
738
- "Fields `{}` writer - {}" ,
728
+ "Fields `{}` writer - {description }" ,
739
729
util:: replace_suffix( & f. name, suffixes_str) ,
740
- description,
741
730
)
742
731
} else {
743
- format ! ( "Field `{}` writer - {}" , f. name, description )
732
+ format ! ( "Field `{}` writer - {description }" , f. name)
744
733
} ;
745
734
746
735
let value_write_ty =
@@ -754,11 +743,11 @@ pub fn fields(
754
743
if let Some ( enum_name) = & evs. name {
755
744
let enum_name_constant_case = enum_name. to_sanitized_constant_case ( ) ;
756
745
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) ;
758
747
enum_value_write_ty
759
748
} else {
760
749
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) ;
762
751
derived_field_value_write_ty
763
752
}
764
753
} else {
@@ -1007,7 +996,7 @@ impl Variant {
1007
996
doc : ev
1008
997
. description
1009
998
. clone ( )
1010
- . unwrap_or_else ( || format ! ( "`{:b}`" , value ) ) ,
999
+ . unwrap_or_else ( || format ! ( "`{value :b}`" ) ) ,
1011
1000
pc : Ident :: new (
1012
1001
& ( if pc {
1013
1002
ev. name . to_sanitized_pascal_case ( )
@@ -1039,9 +1028,9 @@ fn add_with_no_variants(
1039
1028
} ;
1040
1029
1041
1030
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}" )
1043
1032
} else {
1044
- desc. to_owned ( )
1033
+ desc. to_string ( )
1045
1034
} ;
1046
1035
1047
1036
mod_items. extend ( quote ! {
@@ -1085,9 +1074,9 @@ fn add_from_variants(
1085
1074
}
1086
1075
1087
1076
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}" )
1089
1078
} else {
1090
- desc. to_owned ( )
1079
+ desc. to_string ( )
1091
1080
} ;
1092
1081
1093
1082
mod_items. extend ( quote ! {
@@ -1140,9 +1129,9 @@ fn calculate_offset(
1140
1129
1141
1130
fn description_with_bits ( description : & str , offset : u64 , width : u32 ) -> String {
1142
1131
let mut res = if width == 1 {
1143
- format ! ( "Bit {}" , offset )
1132
+ format ! ( "Bit {offset}" )
1144
1133
} else {
1145
- format ! ( "Bits {}:{}" , offset , offset + width as u64 - 1 )
1134
+ format ! ( "Bits {offset }:{}" , offset + width as u64 - 1 )
1146
1135
} ;
1147
1136
if !description. is_empty ( ) {
1148
1137
res. push_str ( " - " ) ;
0 commit comments