mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Merge #318
318: Run cargo fmt r=korken89 a=AfoHT Fix style issues reported by cargo fmt Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
This commit is contained in:
commit
7b7dc01005
4 changed files with 9 additions and 9 deletions
|
@ -28,7 +28,7 @@ mod example {
|
||||||
// The feature needs to be applied everywhere x is defined or used
|
// The feature needs to be applied everywhere x is defined or used
|
||||||
#[cfg(feature = "feature_x")]
|
#[cfg(feature = "feature_x")]
|
||||||
x: 0,
|
x: 0,
|
||||||
dummy: () // dummy such that we have at least one late resource
|
dummy: (), // dummy such that we have at least one late resource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
||||||
let (const_app_init, root_init, user_init, call_init) =
|
let (const_app_init, root_init, user_init, call_init) =
|
||||||
init::codegen(core, app, analysis, extra);
|
init::codegen(core, app, analysis, extra);
|
||||||
|
|
||||||
let (const_app_post_init, post_init_stmts) = post_init::codegen(core, &app, analysis, extra);
|
let (const_app_post_init, post_init_stmts) =
|
||||||
|
post_init::codegen(core, &app, analysis, extra);
|
||||||
|
|
||||||
let (const_app_idle, root_idle, user_idle, call_idle) =
|
let (const_app_idle, root_idle, user_idle, call_idle) =
|
||||||
idle::codegen(core, app, analysis, extra);
|
idle::codegen(core, app, analysis, extra);
|
||||||
|
|
|
@ -47,9 +47,9 @@ pub fn codegen(
|
||||||
let cfgs = &app.late_resources[name].cfgs;
|
let cfgs = &app.late_resources[name].cfgs;
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
pub #name: #ty
|
pub #name: #ty
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,16 +16,15 @@ pub fn codegen(
|
||||||
|
|
||||||
// initialize late resources
|
// initialize late resources
|
||||||
if let Some(late_resources) = analysis.late_resources.get(&core) {
|
if let Some(late_resources) = analysis.late_resources.get(&core) {
|
||||||
|
|
||||||
for name in late_resources {
|
for name in late_resources {
|
||||||
// if it's live
|
// if it's live
|
||||||
let cfgs = app.late_resources[name].cfgs.clone();
|
let cfgs = app.late_resources[name].cfgs.clone();
|
||||||
if analysis.locations.get(name).is_some() {
|
if analysis.locations.get(name).is_some() {
|
||||||
// Need to also include the cfgs
|
// Need to also include the cfgs
|
||||||
stmts.push(quote!(
|
stmts.push(quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
#name.as_mut_ptr().write(late.#name);
|
#name.as_mut_ptr().write(late.#name);
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue