We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dad72fc commit a98669bCopy full SHA for a98669b
src/lib.rs
@@ -147,9 +147,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
147
///
148
/// #[async_attributes::bench]
149
/// async fn bench_1(b: &mut test::Bencher) {
150
-/// b.iter(|| {
151
-/// println!("hello world");
152
-/// })
+/// println!("hello world");
153
/// }
154
/// ```
155
#[proc_macro_attribute]
@@ -178,9 +176,9 @@ pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream {
178
176
#[bench]
179
177
#(#attrs)*
180
fn #name(b: &mut test::Bencher) #ret {
181
- task::block_on(task::spawn(async {
182
- #body
183
- }))
+ b.iter(|| {
+ let _ = async_std::task::block_on(async { #body });
+ });
184
}
185
};
186
0 commit comments