mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-25 03:19:34 +01:00
make compatible with the unsafe_code lint
This commit is contained in:
parent
97a7e38db7
commit
877a32448f
2 changed files with 12 additions and 0 deletions
|
@ -18,6 +18,7 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
|
||||||
::trans::tasks(app, ownerships, &mut root);
|
::trans::tasks(app, ownerships, &mut root);
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
fn main() {
|
fn main() {
|
||||||
#(#main)*
|
#(#main)*
|
||||||
}
|
}
|
||||||
|
@ -161,6 +162,7 @@ fn idle(
|
||||||
}
|
}
|
||||||
|
|
||||||
mod_items.push(quote! {
|
mod_items.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
impl Resources {
|
impl Resources {
|
||||||
pub unsafe fn new() -> Self {
|
pub unsafe fn new() -> Self {
|
||||||
Resources {
|
Resources {
|
||||||
|
@ -175,6 +177,7 @@ fn idle(
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
mod idle {
|
mod idle {
|
||||||
#(#mod_items)*
|
#(#mod_items)*
|
||||||
}
|
}
|
||||||
|
@ -227,6 +230,7 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
mod_items.push(quote! {
|
mod_items.push(quote! {
|
||||||
pub use ::_initResources as Resources;
|
pub use ::_initResources as Resources;
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
impl<#lifetime> Resources<#lifetime> {
|
impl<#lifetime> Resources<#lifetime> {
|
||||||
pub unsafe fn new() -> Self {
|
pub unsafe fn new() -> Self {
|
||||||
Resources {
|
Resources {
|
||||||
|
@ -241,6 +245,7 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
mod init {
|
mod init {
|
||||||
pub use ::#device::Peripherals;
|
pub use ::#device::Peripherals;
|
||||||
|
|
||||||
|
@ -435,6 +440,7 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
|
|
||||||
impls.push(quote! {
|
impls.push(quote! {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[allow(unsafe_code)]
|
||||||
impl _resource::#name {
|
impl _resource::#name {
|
||||||
#(#impl_items)*
|
#(#impl_items)*
|
||||||
}
|
}
|
||||||
|
@ -444,6 +450,7 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct #name { _0: () }
|
pub struct #name { _0: () }
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
impl #name {
|
impl #name {
|
||||||
pub unsafe fn new() -> Self {
|
pub unsafe fn new() -> Self {
|
||||||
#name { _0: () }
|
#name { _0: () }
|
||||||
|
@ -455,6 +462,7 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
mod _resource {
|
mod _resource {
|
||||||
#(#items)*
|
#(#items)*
|
||||||
}
|
}
|
||||||
|
@ -538,6 +546,7 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
items.push(quote! {
|
items.push(quote! {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
impl<#lifetime> Resources<#lifetime> {
|
impl<#lifetime> Resources<#lifetime> {
|
||||||
pub unsafe fn new() -> Self {
|
pub unsafe fn new() -> Self {
|
||||||
Resources {
|
Resources {
|
||||||
|
@ -551,6 +560,7 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
root.push(quote!{
|
root.push(quote!{
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
#[allow(unsafe_code)]
|
||||||
mod #name {
|
mod #name {
|
||||||
#[deny(dead_code)]
|
#[deny(dead_code)]
|
||||||
pub const #name: u8 = #priority;
|
pub const #name: u8 = #priority;
|
||||||
|
|
|
@ -219,6 +219,7 @@ where
|
||||||
macro_rules! task {
|
macro_rules! task {
|
||||||
($NAME:ident, $body:path) => {
|
($NAME:ident, $body:path) => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
#[allow(unsafe_code)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn $NAME() {
|
pub unsafe extern "C" fn $NAME() {
|
||||||
let f: fn(&mut $crate::Threshold, ::$NAME::Resources) = $body;
|
let f: fn(&mut $crate::Threshold, ::$NAME::Resources) = $body;
|
||||||
|
@ -237,6 +238,7 @@ macro_rules! task {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
#[allow(unsafe_code)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn $NAME() {
|
pub unsafe extern "C" fn $NAME() {
|
||||||
let f: fn(
|
let f: fn(
|
||||||
|
|
Loading…
Reference in a new issue