mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
tokio-macros: compat with clippy::unwrap_used (#3926)
This commit is contained in:
committed by
Eliza Weisman
parent
ea87e4ec44
commit
f49b7fc6da
+16
-14
@@ -201,12 +201,15 @@ fn parse_knobs(
|
|||||||
for arg in args {
|
for arg in args {
|
||||||
match arg {
|
match arg {
|
||||||
syn::NestedMeta::Meta(syn::Meta::NameValue(namevalue)) => {
|
syn::NestedMeta::Meta(syn::Meta::NameValue(namevalue)) => {
|
||||||
let ident = namevalue.path.get_ident();
|
let ident = namevalue
|
||||||
if ident.is_none() {
|
.path
|
||||||
let msg = "Must have specified ident";
|
.get_ident()
|
||||||
return Err(syn::Error::new_spanned(namevalue, msg));
|
.ok_or_else(|| {
|
||||||
}
|
syn::Error::new_spanned(&namevalue, "Must have specified ident")
|
||||||
match ident.unwrap().to_string().to_lowercase().as_str() {
|
})?
|
||||||
|
.to_string()
|
||||||
|
.to_lowercase();
|
||||||
|
match ident.as_str() {
|
||||||
"worker_threads" => {
|
"worker_threads" => {
|
||||||
config.set_worker_threads(
|
config.set_worker_threads(
|
||||||
namevalue.lit.clone(),
|
namevalue.lit.clone(),
|
||||||
@@ -239,12 +242,11 @@ fn parse_knobs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
syn::NestedMeta::Meta(syn::Meta::Path(path)) => {
|
syn::NestedMeta::Meta(syn::Meta::Path(path)) => {
|
||||||
let ident = path.get_ident();
|
let name = path
|
||||||
if ident.is_none() {
|
.get_ident()
|
||||||
let msg = "Must have specified ident";
|
.ok_or_else(|| syn::Error::new_spanned(&path, "Must have specified ident"))?
|
||||||
return Err(syn::Error::new_spanned(path, msg));
|
.to_string()
|
||||||
}
|
.to_lowercase();
|
||||||
let name = ident.unwrap().to_string().to_lowercase();
|
|
||||||
let msg = match name.as_str() {
|
let msg = match name.as_str() {
|
||||||
"threaded_scheduler" | "multi_thread" => {
|
"threaded_scheduler" | "multi_thread" => {
|
||||||
format!(
|
format!(
|
||||||
@@ -326,11 +328,11 @@ fn parse_knobs(
|
|||||||
#rt
|
#rt
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.expect("Failed building the Runtime")
|
||||||
.block_on(async #body)
|
.block_on(async #body)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.expect("Parsing failure");
|
||||||
input.block.brace_token = brace_token;
|
input.block.brace_token = brace_token;
|
||||||
|
|
||||||
let result = quote! {
|
let result = quote! {
|
||||||
|
|||||||
Reference in New Issue
Block a user