Skip to content

Commit 83aa309

Browse files
Merge #210
210: Edition-2018ify crate r=korken89 a=therealprof Signed-off-by: Daniel Egger <[email protected]> Co-authored-by: Daniel Egger <[email protected]>
2 parents 6c3367b + 67b9557 commit 83aa309

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

cortex-m-rt/macros/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
88
name = "cortex-m-rt-macros"
99
repository = "https://github.com/japaric/cortex-m-rt"
1010
version = "0.1.6"
11+
edition = "2018"
1112

1213
[lib]
1314
proc-macro = true

cortex-m-rt/macros/src/lib.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
#![deny(warnings)]
22

33
extern crate proc_macro;
4-
extern crate rand;
5-
#[macro_use]
6-
extern crate quote;
7-
extern crate core;
8-
extern crate proc_macro2;
9-
#[macro_use]
10-
extern crate syn;
114

5+
use proc_macro::TokenStream;
126
use proc_macro2::Span;
13-
use rand::Rng;
14-
use rand::SeedableRng;
7+
use rand::{Rng, SeedableRng};
158
use std::collections::HashSet;
169
use std::sync::atomic::{AtomicUsize, Ordering};
1710
use std::time::{SystemTime, UNIX_EPOCH};
1811
use syn::{
19-
parse, spanned::Spanned, AttrStyle, Attribute, FnArg, Ident, Item, ItemFn, ItemStatic,
20-
ReturnType, Stmt, Type, Visibility,
12+
parse, parse_macro_input, spanned::Spanned, AttrStyle, Attribute, FnArg, Ident, Item, ItemFn,
13+
ItemStatic, ReturnType, Stmt, Type, Visibility,
2114
};
15+
use quote::quote;
2216

2317
static CALL_COUNT: AtomicUsize = AtomicUsize::new(0);
2418

25-
use proc_macro::TokenStream;
26-
2719
/// Attribute to declare the entry point of the program
2820
///
2921
/// **IMPORTANT**: This attribute must appear exactly *once* in the dependency graph. Also, if you
@@ -736,9 +728,9 @@ fn random_ident() -> Ident {
736728
&(0..16)
737729
.map(|i| {
738730
if i == 0 || rng.gen() {
739-
('a' as u8 + rng.gen::<u8>() % 25) as char
731+
(b'a' + rng.gen::<u8>() % 25) as char
740732
} else {
741-
('0' as u8 + rng.gen::<u8>() % 10) as char
733+
(b'0' + rng.gen::<u8>() % 10) as char
742734
}
743735
})
744736
.collect::<String>(),

0 commit comments

Comments
 (0)