File tree 2 files changed +15
-12
lines changed
2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ impl Parse for Riscv {
29
29
. map ( |i| Exception :: parse ( & i, config) )
30
30
. collect ( ) ;
31
31
builder = builder. exceptions ( exceptions?) ;
32
- } ;
32
+ }
33
33
34
34
if let Some ( priorities) = tree. get_child ( "priorities" ) {
35
35
let priorities: Result < Vec < _ > , _ > = priorities
@@ -38,7 +38,7 @@ impl Parse for Riscv {
38
38
. map ( |i| Priority :: parse ( & i, config) )
39
39
. collect ( ) ;
40
40
builder = builder. priorities ( priorities?) ;
41
- } ;
41
+ }
42
42
43
43
if let Some ( harts) = tree. get_child ( "harts" ) {
44
44
let harts: Result < Vec < _ > , _ > = harts
@@ -47,7 +47,7 @@ impl Parse for Riscv {
47
47
. map ( |i| Hart :: parse ( & i, config) )
48
48
. collect ( ) ;
49
49
builder = builder. harts ( harts?) ;
50
- } ;
50
+ }
51
51
52
52
builder
53
53
. build ( config. validate_level )
Original file line number Diff line number Diff line change @@ -99,15 +99,18 @@ impl RiscvBuilder {
99
99
/// Validate and build a [`Riscv`].
100
100
pub fn build ( self , lvl : ValidateLevel ) -> Result < Riscv , SvdError > {
101
101
let riscv = Riscv {
102
- core_interrupts : self
103
- . core_interrupts
104
- . ok_or_else ( || BuildError :: Uninitialized ( "core_interrupts" . to_string ( ) ) ) ?,
105
- exceptions : self
106
- . exceptions
107
- . ok_or_else ( || BuildError :: Uninitialized ( "exceptions" . to_string ( ) ) ) ?,
108
- priorities : self
109
- . priorities
110
- . ok_or_else ( || BuildError :: Uninitialized ( "priorities" . to_string ( ) ) ) ?,
102
+ core_interrupts : match self . core_interrupts {
103
+ Some ( core_interrupts) => core_interrupts,
104
+ None => Vec :: new ( ) ,
105
+ } ,
106
+ exceptions : match self . exceptions {
107
+ Some ( exceptions) => exceptions,
108
+ None => Vec :: new ( ) ,
109
+ } ,
110
+ priorities : match self . priorities {
111
+ Some ( priorities) => priorities,
112
+ None => Vec :: new ( ) ,
113
+ } ,
111
114
harts : self
112
115
. harts
113
116
. ok_or_else ( || BuildError :: Uninitialized ( "harts" . to_string ( ) ) ) ?,
You can’t perform that action at this time.
0 commit comments