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> {
366
366
. as_ref ( )
367
367
. expect ( & format ! ( "{:#?} has no `registers` field" , p) ) ;
368
368
369
- for register in expand ( registers) . iter ( ) {
369
+ for register in & expand ( registers) {
370
370
let pad = if let Some ( pad) = register. offset
371
371
. checked_sub ( offset) {
372
372
pad
@@ -534,6 +534,7 @@ fn access(r: &Register) -> Access {
534
534
} )
535
535
}
536
536
537
+ #[ cfg_attr( feature = "cargo-clippy" , allow( cyclomatic_complexity) ) ]
537
538
#[ doc( hidden) ]
538
539
pub fn gen_register ( r : & Register ,
539
540
d : & Defaults ,
@@ -1201,12 +1202,10 @@ fn field_doc(bit_range: BitRange, doc: Option<&String>) -> String {
1201
1202
} else {
1202
1203
format ! ( "Bits {}:{} - {}" , offset, offset + width - 1 , doc)
1203
1204
}
1205
+ } else if width == 1 {
1206
+ format ! ( "Bit {}" , offset)
1204
1207
} 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 )
1210
1209
}
1211
1210
}
1212
1211
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ fn find_peripheral<F: Fn(&str) -> bool>(device: &svd::Device,
70
70
}
71
71
72
72
fn gen_peripheral_desc ( p : & svd:: Peripheral , def : & svd:: Defaults ) -> String {
73
- svd2rust:: gen_peripheral ( p, & def)
73
+ svd2rust:: gen_peripheral ( p, def)
74
74
. iter ( )
75
75
. map ( |i| i. to_string ( ) )
76
76
. collect :: < Vec < _ > > ( )
You can’t perform that action at this time.
0 commit comments