diff options
Diffstat (limited to 'cortex-m-rt/macros/src/lib.rs')
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 22 |
1 files changed, 7 insertions, 15 deletions
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>(), |