Skip to content

Commit 1c773fb

Browse files
committed
refactor: use Option::map instead of if-let
Thanks to @burrbull for the review!
1 parent 328d0c3 commit 1c773fb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/generate/interrupt.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,11 @@ pub fn render(
188188
writeln!(device_x, "PROVIDE({name} = DefaultHandler);")?;
189189
}
190190

191-
let link_section_attr = if let Some(section) = &config.interrupt_link_section {
191+
let link_section_attr = config.interrupt_link_section.as_ref().map(|section| {
192192
quote! {
193193
#[link_section = #section]
194194
}
195-
} else {
196-
quote! {}
197-
};
195+
});
198196

199197
root.extend(quote! {
200198
#[cfg(feature = "rt")]
@@ -222,13 +220,11 @@ pub fn render(
222220
writeln!(device_x, "PROVIDE({name} = DefaultHandler);")?;
223221
}
224222

225-
let link_section_attr = if let Some(section) = &config.interrupt_link_section {
223+
let link_section_attr = config.interrupt_link_section.as_ref().map(|section| {
226224
quote! {
227225
#[link_section = #section]
228226
}
229-
} else {
230-
quote! {}
231-
};
227+
});
232228

233229
root.extend(quote! {
234230
#[cfg(feature = "rt")]

0 commit comments

Comments
 (0)