aboutsummaryrefslogtreecommitdiff
path: root/src/entry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry.rs')
-rw-r--r--src/entry.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/entry.rs b/src/entry.rs
index 3706026..edac530 100644
--- a/src/entry.rs
+++ b/src/entry.rs
@@ -126,22 +126,22 @@ impl Configuration {
}
fn build(&self) -> Result<FinalConfig, syn::Error> {
- use RuntimeFlavor as F;
-
let flavor = self.flavor.unwrap_or(self.default_flavor);
+ use RuntimeFlavor::*;
+
let worker_threads = match (flavor, self.worker_threads) {
- (F::CurrentThread, Some((_, worker_threads_span))) => {
+ (CurrentThread, Some((_, worker_threads_span))) => {
let msg = format!(
"The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[{}(flavor = \"multi_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(worker_threads_span, msg));
}
- (F::CurrentThread, None) => None,
- (F::Threaded, worker_threads) if self.rt_multi_thread_available => {
+ (CurrentThread, None) => None,
+ (Threaded, worker_threads) if self.rt_multi_thread_available => {
worker_threads.map(|(val, _span)| val)
}
- (F::Threaded, _) => {
+ (Threaded, _) => {
let msg = if self.flavor.is_none() {
"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled."
} else {
@@ -152,14 +152,14 @@ impl Configuration {
};
let start_paused = match (flavor, self.start_paused) {
- (F::Threaded, Some((_, start_paused_span))) => {
+ (Threaded, Some((_, start_paused_span))) => {
let msg = format!(
"The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \"current_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(start_paused_span, msg));
}
- (F::CurrentThread, Some((start_paused, _))) => Some(start_paused),
+ (CurrentThread, Some((start_paused, _))) => Some(start_paused),
(_, None) => None,
};
@@ -354,10 +354,10 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
},
};
if let Some(v) = config.worker_threads {
- rt = quote_spanned! {last_stmt_start_span=> #rt.worker_threads(#v) };
+ rt = quote! { #rt.worker_threads(#v) };
}
if let Some(v) = config.start_paused {
- rt = quote_spanned! {last_stmt_start_span=> #rt.start_paused(#v) };
+ rt = quote! { #rt.start_paused(#v) };
}
let header = if is_test {
@@ -402,7 +402,7 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
quote! {
let body = async #body;
#crate_path::pin!(body);
- let body: ::core::pin::Pin<&mut dyn ::core::future::Future<Output = #output_type>> = body;
+ let body: ::std::pin::Pin<&mut dyn ::std::future::Future<Output = #output_type>> = body;
}
} else {
quote! {
@@ -586,6 +586,6 @@ impl ToTokens for Body<'_> {
for stmt in self.stmts {
stmt.to_tokens(tokens);
}
- });
+ })
}
}