Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokio-macros: compat with clippy::unwrap_used #3926

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions tokio-macros/src/entry.rs
Expand Up @@ -201,12 +201,13 @@ fn parse_knobs(
for arg in args {
match arg {
syn::NestedMeta::Meta(syn::Meta::NameValue(namevalue)) => {
let ident = namevalue.path.get_ident();
if ident.is_none() {
let ident = if let Some(ident) = namevalue.path.get_ident() {
ident.to_string().to_lowercase()
} else {
let msg = "Must have specified ident";
return Err(syn::Error::new_spanned(namevalue, msg));
}
match ident.unwrap().to_string().to_lowercase().as_str() {
};
match ident.as_str() {
"worker_threads" => {
config.set_worker_threads(
namevalue.lit.clone(),
Expand Down Expand Up @@ -244,7 +245,10 @@ fn parse_knobs(
let msg = "Must have specified ident";
return Err(syn::Error::new_spanned(path, msg));
}
let name = ident.unwrap().to_string().to_lowercase();
let name = ident
.expect("Must have specified ident")
.to_string()
.to_lowercase();
blasrodri marked this conversation as resolved.
Show resolved Hide resolved
let msg = match name.as_str() {
"threaded_scheduler" | "multi_thread" => {
format!(
Expand Down Expand Up @@ -326,11 +330,11 @@ fn parse_knobs(
#rt
.enable_all()
.build()
.unwrap()
.expect("Failed building the Runtime")
.block_on(async #body)
blasrodri marked this conversation as resolved.
Show resolved Hide resolved
}
})
.unwrap();
.expect("Parsing failure");
input.block.brace_token = brace_token;

let result = quote! {
Expand Down