mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-24 04:32:52 +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() }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !mod_items.is_empty() {
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
mod idle {
|
mod idle {
|
||||||
#(#mod_items)*
|
#(#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! {
|
root.push(quote! {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
mod _resource {
|
mod _resource {
|
||||||
#(#items)*
|
#(#items)*
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
root.push(quote! {
|
||||||
#(#impls)*
|
#(#impls)*
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue