File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,7 @@ pub fn gen_peripheral(p: &Peripheral, d: &Defaults) -> Vec<Tokens> {
366366 . as_ref ( )
367367 . expect ( & format ! ( "{:#?} has no `registers` field" , p) ) ;
368368
369- for register in expand ( registers) . iter ( ) {
369+ for register in & expand ( registers) {
370370 let pad = if let Some ( pad) = register. offset
371371 . checked_sub ( offset) {
372372 pad
@@ -534,6 +534,7 @@ fn access(r: &Register) -> Access {
534534 } )
535535}
536536
537+ #[ cfg_attr( feature = "cargo-clippy" , allow( cyclomatic_complexity) ) ]
537538#[ doc( hidden) ]
538539pub fn gen_register ( r : & Register ,
539540 d : & Defaults ,
@@ -1201,12 +1202,10 @@ fn field_doc(bit_range: BitRange, doc: Option<&String>) -> String {
12011202 } else {
12021203 format ! ( "Bits {}:{} - {}" , offset, offset + width - 1 , doc)
12031204 }
1205+ } else if width == 1 {
1206+ format ! ( "Bit {}" , offset)
12041207 } else {
1205- if width == 1 {
1206- format ! ( "Bit {}" , offset)
1207- } else {
1208- format ! ( "Bits {}:{}" , offset, offset + width - 1 )
1209- }
1208+ format ! ( "Bits {}:{}" , offset, offset + width - 1 )
12101209 }
12111210}
12121211
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ fn find_peripheral<F: Fn(&str) -> bool>(device: &svd::Device,
7070}
7171
7272fn gen_peripheral_desc ( p : & svd:: Peripheral , def : & svd:: Defaults ) -> String {
73- svd2rust:: gen_peripheral ( p, & def)
73+ svd2rust:: gen_peripheral ( p, def)
7474 . iter ( )
7575 . map ( |i| i. to_string ( ) )
7676 . collect :: < Vec < _ > > ( )
You can’t perform that action at this time.
0 commit comments