Skip to content

Commit ee35f3e

Browse files
committed
Do not emit mod interrupt if there aren't any defined.
Or else the resulting file will not compile. Fixes #77.
1 parent fa5868a commit ee35f3e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/generate.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,16 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
219219
},
220220
);
221221

222-
items.push(
223-
quote! {
224-
/// Interrupts
225-
pub mod interrupt {
226-
#(#mod_items)*
227-
}
228-
},
229-
);
222+
if interrupts.len() > 0 {
223+
items.push(
224+
quote! {
225+
/// Interrupts
226+
pub mod interrupt {
227+
#(#mod_items)*
228+
}
229+
},
230+
);
231+
}
230232
}
231233

232234
pub fn peripheral(

0 commit comments

Comments
 (0)