|
1 | 1 | #![deny(warnings)]
|
2 | 2 |
|
3 | 3 | 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; |
11 | 4 |
|
| 5 | +use proc_macro::TokenStream; |
12 | 6 | use proc_macro2::Span;
|
13 |
| -use rand::Rng; |
14 |
| -use rand::SeedableRng; |
| 7 | +use rand::{Rng, SeedableRng}; |
15 | 8 | use std::collections::HashSet;
|
16 | 9 | use std::sync::atomic::{AtomicUsize, Ordering};
|
17 | 10 | use std::time::{SystemTime, UNIX_EPOCH};
|
18 | 11 | 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, |
21 | 14 | };
|
| 15 | +use quote::quote; |
22 | 16 |
|
23 | 17 | static CALL_COUNT: AtomicUsize = AtomicUsize::new(0);
|
24 | 18 |
|
25 |
| -use proc_macro::TokenStream; |
26 |
| - |
27 | 19 | /// Attribute to declare the entry point of the program
|
28 | 20 | ///
|
29 | 21 | /// **IMPORTANT**: This attribute must appear exactly *once* in the dependency graph. Also, if you
|
@@ -736,9 +728,9 @@ fn random_ident() -> Ident {
|
736 | 728 | &(0..16)
|
737 | 729 | .map(|i| {
|
738 | 730 | if i == 0 || rng.gen() {
|
739 |
| - ('a' as u8 + rng.gen::<u8>() % 25) as char |
| 731 | + (b'a' + rng.gen::<u8>() % 25) as char |
740 | 732 | } else {
|
741 |
| - ('0' as u8 + rng.gen::<u8>() % 10) as char |
| 733 | + (b'0' + rng.gen::<u8>() % 10) as char |
742 | 734 | }
|
743 | 735 | })
|
744 | 736 | .collect::<String>(),
|
|
0 commit comments