diff options
author | 2019-11-01 20:47:43 +0000 | |
---|---|---|
committer | 2019-11-01 20:47:43 +0000 | |
commit | 83aa30930babdbec0acd61bece8f116ce52bf036 (patch) | |
tree | 19262bdfde29bd5ad46b5f925f907e89be2df1d0 | |
parent | 6c3367bdf1b890241247d62eab7ff1ee8b067f42 (diff) | |
parent | 67b955701ed8b7a41fe2502ff655fcc8a1025bf2 (diff) | |
download | cortex-m-83aa30930babdbec0acd61bece8f116ce52bf036.tar.gz cortex-m-83aa30930babdbec0acd61bece8f116ce52bf036.tar.zst cortex-m-83aa30930babdbec0acd61bece8f116ce52bf036.zip |
Merge #210
210: Edition-2018ify crate r=korken89 a=therealprof
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
Co-authored-by: Daniel Egger <daniel@eggers-club.de>
-rw-r--r-- | cortex-m-rt/macros/Cargo.toml | 1 | ||||
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 22 |
2 files changed, 8 insertions, 15 deletions
diff --git a/cortex-m-rt/macros/Cargo.toml b/cortex-m-rt/macros/Cargo.toml index 4e2b56d..4e46aaa 100644 --- a/cortex-m-rt/macros/Cargo.toml +++ b/cortex-m-rt/macros/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0" name = "cortex-m-rt-macros" repository = "https://github.com/japaric/cortex-m-rt" version = "0.1.6" +edition = "2018" [lib] proc-macro = true diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index 8f437ff..bf930d0 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -1,29 +1,21 @@ #![deny(warnings)] extern crate proc_macro; -extern crate rand; -#[macro_use] -extern crate quote; -extern crate core; -extern crate proc_macro2; -#[macro_use] -extern crate syn; +use proc_macro::TokenStream; use proc_macro2::Span; -use rand::Rng; -use rand::SeedableRng; +use rand::{Rng, SeedableRng}; use std::collections::HashSet; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::{SystemTime, UNIX_EPOCH}; use syn::{ - parse, spanned::Spanned, AttrStyle, Attribute, FnArg, Ident, Item, ItemFn, ItemStatic, - ReturnType, Stmt, Type, Visibility, + parse, parse_macro_input, spanned::Spanned, AttrStyle, Attribute, FnArg, Ident, Item, ItemFn, + ItemStatic, ReturnType, Stmt, Type, Visibility, }; +use quote::quote; static CALL_COUNT: AtomicUsize = AtomicUsize::new(0); -use proc_macro::TokenStream; - /// Attribute to declare the entry point of the program /// /// **IMPORTANT**: This attribute must appear exactly *once* in the dependency graph. Also, if you @@ -736,9 +728,9 @@ fn random_ident() -> Ident { &(0..16) .map(|i| { if i == 0 || rng.gen() { - ('a' as u8 + rng.gen::<u8>() % 25) as char + (b'a' + rng.gen::<u8>() % 25) as char } else { - ('0' as u8 + rng.gen::<u8>() % 10) as char + (b'0' + rng.gen::<u8>() % 10) as char } }) .collect::<String>(), |