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
remove EthAbiType derive generated unwrap #2056
remove EthAbiType derive generated unwrap #2056
Conversation
quote_spanned! { f.span() => #name: iter | ||
.next() | ||
.ok_or_else(|| #core_crate::abi::InvalidOutputType(::std::format!( | ||
"Struct field {:} doesn't have correspond token.", #name_str | ||
))) | ||
.and_then(|t| #core_crate::abi::Tokenizable::from_token(t))? | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just use an expect
here, because there's already a len check so this is guaranteed to succeed, hence the unwrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I don't have problems with expect
, there is also https://rust-lang.github.io/rust-clippy/master/#expect_used lint kind which some people might want to warn about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error can never happen though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know.Just want to pass the lint check for unwrap in my situation. If you want expect
, then expect
it is.
108ca1a
to
8be05c3
Compare
8be05c3
to
9dcc5a2
Compare
Motivation
#2053
Solution
Replace unwrap with safer method
PR Checklist