diff options
-rw-r--r-- | macros/Cargo.toml | 1 | ||||
-rw-r--r-- | macros/src/analyze.rs | 2 | ||||
-rw-r--r-- | macros/src/check.rs | 6 | ||||
-rw-r--r-- | macros/src/codegen.rs | 6 | ||||
-rw-r--r-- | macros/src/lib.rs | 4 | ||||
-rw-r--r-- | macros/src/syntax.rs | 24 |
6 files changed, 21 insertions, 22 deletions
diff --git a/macros/Cargo.toml b/macros/Cargo.toml index dd5fb546..4c4b734b 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -3,6 +3,7 @@ authors = ["Jorge Aparicio <jorge@japaric.io>"] categories = ["concurrency", "embedded", "no-std"] description = "Procedural macros of the cortex-m-rtfm crate" documentation = "https://japaric.github.io/cortex-m-rtfm/api/cortex_m_rtfm" +edition = "2018" keywords = ["arm", "cortex-m"] license = "MIT OR Apache-2.0" name = "cortex-m-rtfm-macros" diff --git a/macros/src/analyze.rs b/macros/src/analyze.rs index 869b5d20..19575b77 100644 --- a/macros/src/analyze.rs +++ b/macros/src/analyze.rs @@ -5,7 +5,7 @@ use std::{ use syn::{Attribute, Ident, Type}; -use syntax::{App, Idents}; +use crate::syntax::{App, Idents}; pub type Ownerships = HashMap<Ident, Ownership>; diff --git a/macros/src/check.rs b/macros/src/check.rs index 85184596..ae2262a8 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -3,14 +3,14 @@ use std::{collections::HashSet, iter}; use proc_macro2::Span; use syn::parse; -use syntax::App; +use crate::syntax::App; pub fn app(app: &App) -> parse::Result<()> { // Check that all referenced resources have been declared for res in app .idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { Box::new(idle.args.resources.iter()) }) + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(idle.args.resources.iter()) }) .unwrap_or_else(|| Box::new(iter::empty())) .chain(&app.init.args.resources) .chain(app.exceptions.values().flat_map(|e| &e.args.resources)) @@ -53,7 +53,7 @@ pub fn app(app: &App) -> parse::Result<()> { for task in app .idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(idle.args.schedule.iter().chain(&idle.args.spawn)) }) .unwrap_or_else(|| Box::new(iter::empty())) diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index eafea945..45c3e263 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -12,8 +12,10 @@ use quote::quote; use rand::{Rng, SeedableRng}; use syn::{parse_quote, ArgCaptured, Attribute, Ident, IntSuffix, LitInt}; -use analyze::{Analysis, Ownership}; -use syntax::{App, Idents, Static}; +use crate::{ + analyze::{Analysis, Ownership}, + syntax::{App, Idents, Static}, +}; // NOTE to avoid polluting the user namespaces we map some identifiers to pseudo-hygienic names. // In some instances we also use the pseudo-hygienic names for safety, for example the user should diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 2e32da65..c8d9fee1 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -2,10 +2,6 @@ #![recursion_limit = "128"] extern crate proc_macro; -extern crate proc_macro2; -extern crate quote; -extern crate rand; -extern crate syn; use proc_macro::TokenStream; use syn::parse_macro_input; diff --git a/macros/src/syntax.rs b/macros/src/syntax.rs index b9424fbe..85f3caaa 100644 --- a/macros/src/syntax.rs +++ b/macros/src/syntax.rs @@ -20,7 +20,7 @@ pub struct AppArgs { } impl Parse for AppArgs { - fn parse(input: ParseStream) -> parse::Result<Self> { + fn parse(input: ParseStream<'_>) -> parse::Result<Self> { let mut device = None; loop { if input.is_empty() { @@ -80,8 +80,8 @@ pub struct Input { } impl Parse for Input { - fn parse(input: ParseStream) -> parse::Result<Self> { - fn parse_items(input: ParseStream) -> parse::Result<Vec<Item>> { + fn parse(input: ParseStream<'_>) -> parse::Result<Self> { + fn parse_items(input: ParseStream<'_>) -> parse::Result<Vec<Item>> { let mut items = vec![]; while !input.is_empty() { @@ -254,7 +254,7 @@ impl App { pub fn resource_accesses(&self) -> impl Iterator<Item = (u8, &Ident)> { self.idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(idle.args.resources.iter().map(|res| (0, res))) }) .unwrap_or_else(|| Box::new(iter::empty())) @@ -293,7 +293,7 @@ impl App { .chain( self.idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(idle.args.spawn.iter().map(|s| (Some(0), s))) }) .unwrap_or_else(|| Box::new(iter::empty())), @@ -329,7 +329,7 @@ impl App { .chain( self.idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(idle.args.schedule.iter().map(|s| (Some(0), s))) }) .unwrap_or_else(|| Box::new(iter::empty())), @@ -358,7 +358,7 @@ impl App { pub fn schedule_callers(&self) -> impl Iterator<Item = (Ident, &Idents)> { self.idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(iter::once(( Ident::new("idle", Span::call_site()), &idle.args.schedule, @@ -389,7 +389,7 @@ impl App { pub fn spawn_callers(&self) -> impl Iterator<Item = (Ident, &Idents)> { self.idle .as_ref() - .map(|idle| -> Box<Iterator<Item = _>> { + .map(|idle| -> Box<dyn Iterator<Item = _>> { Box::new(iter::once(( Ident::new("idle", Span::call_site()), &idle.args.spawn, @@ -492,7 +492,7 @@ impl Default for InitArgs { } impl Parse for InitArgs { - fn parse(input: ParseStream) -> parse::Result<InitArgs> { + fn parse(input: ParseStream<'_>) -> parse::Result<InitArgs> { if input.is_empty() { return Ok(InitArgs::default()); } @@ -662,7 +662,7 @@ pub struct ExceptionArgs { } impl Parse for ExceptionArgs { - fn parse(input: ParseStream) -> parse::Result<Self> { + fn parse(input: ParseStream<'_>) -> parse::Result<Self> { parse_args(input, false).map( |TaskArgs { priority, @@ -853,13 +853,13 @@ impl Default for TaskArgs { } impl Parse for TaskArgs { - fn parse(input: ParseStream) -> parse::Result<Self> { + fn parse(input: ParseStream<'_>) -> parse::Result<Self> { parse_args(input, true) } } // Parser shared by TaskArgs and ExceptionArgs / InterruptArgs -fn parse_args(input: ParseStream, accept_capacity: bool) -> parse::Result<TaskArgs> { +fn parse_args(input: ParseStream<'_>, accept_capacity: bool) -> parse::Result<TaskArgs> { if input.is_empty() { return Ok(TaskArgs::default()); } |