mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 22:05:37 +01:00
Clippy with pedantic suggestions
This commit is contained in:
parent
57da1e0403
commit
5ed93bd1bf
17 changed files with 84 additions and 84 deletions
|
|
@ -35,33 +35,8 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
let mangled_name = util::static_shared_resource_ident(name);
|
||||
let shared_name = util::need_to_lock_ident(name);
|
||||
|
||||
if !res.properties.lock_free {
|
||||
if access.is_shared() {
|
||||
lt = Some(quote!('a));
|
||||
|
||||
fields.push(quote!(
|
||||
#(#cfgs)*
|
||||
pub #name: &'a #ty
|
||||
));
|
||||
} else {
|
||||
// Resource proxy
|
||||
lt = Some(quote!('a));
|
||||
|
||||
fields.push(quote!(
|
||||
#(#cfgs)*
|
||||
pub #name: shared_resources::#shared_name<'a>
|
||||
));
|
||||
|
||||
values.push(quote!(
|
||||
#(#cfgs)*
|
||||
#name: shared_resources::#shared_name::new(priority)
|
||||
|
||||
));
|
||||
|
||||
// continue as the value has been filled,
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if res.properties.lock_free {
|
||||
// Lock free resources of `idle` and `init` get 'static lifetime
|
||||
let lt = if ctxt.runs_once() {
|
||||
quote!('static)
|
||||
} else {
|
||||
|
|
@ -73,6 +48,30 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
#(#cfgs)*
|
||||
pub #name: &#lt #mut_ #ty
|
||||
));
|
||||
} else if access.is_shared() {
|
||||
lt = Some(quote!('a));
|
||||
|
||||
fields.push(quote!(
|
||||
#(#cfgs)*
|
||||
pub #name: &'a #ty
|
||||
));
|
||||
} else {
|
||||
// Resource proxy
|
||||
lt = Some(quote!('a));
|
||||
|
||||
fields.push(quote!(
|
||||
#(#cfgs)*
|
||||
pub #name: shared_resources::#shared_name<'a>
|
||||
));
|
||||
|
||||
values.push(quote!(
|
||||
#(#cfgs)*
|
||||
#name: shared_resources::#shared_name::new(priority)
|
||||
|
||||
));
|
||||
|
||||
// continue as the value has been filled,
|
||||
continue;
|
||||
}
|
||||
|
||||
let expr = if access.is_exclusive() {
|
||||
|
|
@ -97,7 +96,7 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
pub __marker__: core::marker::PhantomData<&'a ()>
|
||||
));
|
||||
|
||||
values.push(quote!(__marker__: core::marker::PhantomData))
|
||||
values.push(quote!(__marker__: core::marker::PhantomData));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue