mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 06:54:33 +01:00
don't generate empty modules
This commit is contained in:
parent
b37c45ad2a
commit
dd539d114f
1 changed files with 16 additions and 11 deletions
|
@ -153,12 +153,14 @@ fn idle(
|
||||||
exprs.push(quote!(unsafe { idle::Resources::new() }));
|
exprs.push(quote!(unsafe { idle::Resources::new() }));
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(quote! {
|
if !mod_items.is_empty() {
|
||||||
#[allow(unsafe_code)]
|
root.push(quote! {
|
||||||
mod idle {
|
#[allow(unsafe_code)]
|
||||||
#(#mod_items)*
|
mod idle {
|
||||||
}
|
#(#mod_items)*
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let idle = &app.idle.path;
|
let idle = &app.idle.path;
|
||||||
main.push(quote! {
|
main.push(quote! {
|
||||||
|
@ -486,12 +488,15 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !items.is_empty() {
|
||||||
|
root.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
mod _resource {
|
||||||
|
#(#items)*
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
#[allow(unsafe_code)]
|
|
||||||
mod _resource {
|
|
||||||
#(#items)*
|
|
||||||
}
|
|
||||||
|
|
||||||
#(#impls)*
|
#(#impls)*
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue