aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt
diff options
context:
space:
mode:
Diffstat (limited to 'cortex-m-rt')
-rw-r--r--cortex-m-rt/macros/Cargo.toml1
-rw-r--r--cortex-m-rt/macros/src/lib.rs22
2 files changed, 8 insertions, 15 deletions
diff --git a/cortex-m-rt/macros/Cargo.toml b/cortex-m-rt/macros/Cargo.toml
index c53ec89..4d8d4d8 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>(),