Skip to content

Commit 018e04d

Browse files
committed
minor changes
1 parent abeb4fe commit 018e04d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

riscv/macros/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl PacEnumItem {
121121
};
122122
for v in variants.iter() {
123123
let ident = v.ident.clone();
124-
let value = match v.discriminant.as_ref() {
124+
let value = match v.discriminant.as_ref() {
125125
Some((_, syn::Expr::Lit(expr_lit))) => match &expr_lit.lit {
126126
syn::Lit::Int(lit_int) => {
127127
lit_int.base10_parse::<usize>().unwrap_or_else(|_| {
@@ -291,13 +291,9 @@ core::arch::global_asm!("
291291
fn DefaultHandler();
292292
}
293293

294-
if code < #isr_array_name.len() {
295-
match &#isr_array_name[code] {
296-
Some(handler) => handler(),
297-
None => DefaultHandler(),
298-
}
299-
} else {
300-
DefaultHandler();
294+
match #isr_array_name.get(code) {
295+
Some(Some(handler)) => handler(),
296+
_ => DefaultHandler(),
301297
}
302298
}
303299
});

0 commit comments

Comments
 (0)