diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index fde9490bf5..e45f1a38ce 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -37,11 +37,13 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let pre_init_stmts = pre_init::codegen(&app, analysis, extra); - let (const_app_init, root_init, user_init, user_init_imports, call_init) = init::codegen(app, analysis, extra); + let (const_app_init, root_init, user_init, user_init_imports, call_init) = + init::codegen(app, analysis, extra); let post_init_stmts = post_init::codegen(&app, analysis); - let (const_app_idle, root_idle, user_idle, user_idle_imports, call_idle) = idle::codegen(app, analysis, extra); + let (const_app_idle, root_idle, user_idle, user_idle_imports, call_idle) = + idle::codegen(app, analysis, extra); if user_init.is_some() { const_app_imports.push(quote!( @@ -95,13 +97,22 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { } )); - let (const_app_resources, mod_resources, mod_resources_imports) = resources::codegen(app, analysis, extra); + let (const_app_resources, mod_resources, mod_resources_imports) = + resources::codegen(app, analysis, extra); - let (const_app_hardware_tasks, root_hardware_tasks, user_hardware_tasks, user_hardware_tasks_imports) = - hardware_tasks::codegen(app, analysis, extra); + let ( + const_app_hardware_tasks, + root_hardware_tasks, + user_hardware_tasks, + user_hardware_tasks_imports, + ) = hardware_tasks::codegen(app, analysis, extra); - let (const_app_software_tasks, root_software_tasks, user_software_tasks, user_software_tasks_imports) = - software_tasks::codegen(app, analysis, extra); + let ( + const_app_software_tasks, + root_software_tasks, + user_software_tasks, + user_software_tasks_imports, + ) = software_tasks::codegen(app, analysis, extra); let const_app_dispatchers = dispatchers::codegen(app, analysis, extra); @@ -111,7 +122,6 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let const_app_schedule = schedule::codegen(app, extra); - let user_imports = app.user_imports.clone(); let name = &app.name; let device = extra.device; diff --git a/macros/src/codegen/hardware_tasks.rs b/macros/src/codegen/hardware_tasks.rs index 8f2ab2f63b..a03fd77920 100644 --- a/macros/src/codegen/hardware_tasks.rs +++ b/macros/src/codegen/hardware_tasks.rs @@ -1,5 +1,5 @@ use proc_macro2::TokenStream as TokenStream2; -use quote::{quote, format_ident}; +use quote::{format_ident, quote}; use rtic_syntax::{ast::App, Context}; use crate::{ @@ -128,7 +128,6 @@ pub fn codegen( #[allow(non_snake_case)] use super::#name; )); - } (const_app, root, user_tasks, hardware_tasks_imports) diff --git a/macros/src/codegen/idle.rs b/macros/src/codegen/idle.rs index db454a58ca..2aa9975142 100644 --- a/macros/src/codegen/idle.rs +++ b/macros/src/codegen/idle.rs @@ -1,5 +1,5 @@ use proc_macro2::TokenStream as TokenStream2; -use quote::{quote, format_ident}; +use quote::{format_ident, quote}; use rtic_syntax::{ast::App, Context}; use crate::{ @@ -52,7 +52,6 @@ pub fn codegen( #[allow(non_snake_case)] use super::#name_resource; )); - } if !idle.locals.is_empty() { @@ -81,7 +80,6 @@ pub fn codegen( user_idle_imports.push(quote!( #(#attrs)* #[allow(non_snake_case)] - #cfg_core use super::#name; )); @@ -91,7 +89,13 @@ pub fn codegen( #name::Context::new(&rtic::export::Priority::new(0)) )); - (const_app, root_idle, user_idle, user_idle_imports, call_idle) + ( + const_app, + root_idle, + user_idle, + user_idle_imports, + call_idle, + ) } else { ( None, diff --git a/macros/src/codegen/init.rs b/macros/src/codegen/init.rs index 88a7a23b14..b350298c46 100644 --- a/macros/src/codegen/init.rs +++ b/macros/src/codegen/init.rs @@ -1,5 +1,5 @@ use proc_macro2::TokenStream as TokenStream2; -use quote::{quote, format_ident}; +use quote::{format_ident, quote}; use rtic_syntax::{ast::App, Context}; use crate::{ @@ -101,7 +101,6 @@ pub fn codegen( )); user_init_imports.push(quote!( #(#attrs)* - #cfg_core #[allow(non_snake_case)] use super::#name; )); @@ -128,7 +127,13 @@ pub fn codegen( root_init.push(module::codegen(Context::Init, needs_lt, app, extra)); - (const_app, root_init, user_init, user_init_imports, call_init) + ( + const_app, + root_init, + user_init, + user_init_imports, + call_init, + ) } else { (None, vec![], None, vec![], None) } diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs index a326e68c54..d18a4655f8 100644 --- a/macros/src/codegen/resources.rs +++ b/macros/src/codegen/resources.rs @@ -88,7 +88,6 @@ pub fn codegen( mod_resources_imports.push(quote!( #[allow(non_camel_case_types)] #(#cfgs)* - #cfg_core use super::resources::#name; )); diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index 854c083dca..9e01115265 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -1,5 +1,5 @@ use proc_macro2::TokenStream as TokenStream2; -use quote::{quote, format_ident}; +use quote::{format_ident, quote}; use rtic_syntax::{ast::App, Context}; use crate::{