From a151974245a994ec4c30bb0518677c4b99dce7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Tue, 8 Sep 2020 15:22:32 +0000 Subject: [PATCH] cfg_core is gone, cargo fmt --- macros/src/codegen.rs | 26 ++++++++++++++++++-------- macros/src/codegen/hardware_tasks.rs | 3 +-- macros/src/codegen/idle.rs | 12 ++++++++---- macros/src/codegen/init.rs | 11 ++++++++--- macros/src/codegen/resources.rs | 1 - macros/src/codegen/software_tasks.rs | 2 +- 6 files changed, 36 insertions(+), 19 deletions(-) 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::{