aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/macros/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Daniel Egger <daniel@eggers-club.de> 2019-11-01 18:04:44 +0100
committerGravatar Daniel Egger <daniel@eggers-club.de> 2019-11-01 18:04:44 +0100
commit67b955701ed8b7a41fe2502ff655fcc8a1025bf2 (patch)
treef1a24f9287ba5b24b430d04ef68fbb82736e3b23 /cortex-m-rt/macros/src/lib.rs
parent6e85987c9fe3f3d900f8843a1c3485e2140413ea (diff)
downloadcortex-m-67b955701ed8b7a41fe2502ff655fcc8a1025bf2.tar.gz
cortex-m-67b955701ed8b7a41fe2502ff655fcc8a1025bf2.tar.zst
cortex-m-67b955701ed8b7a41fe2502ff655fcc8a1025bf2.zip
Edition-2018ify crate
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
Diffstat (limited to 'cortex-m-rt/macros/src/lib.rs')
-rw-r--r--cortex-m-rt/macros/src/lib.rs22
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>(),