We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
unnecessary_faillible_conversion
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
This lint would warn against using try_into from the TryInto or TryFrom trait when there is an available Into or From implementation.
try_into
TryInto
TryFrom
Into
From
Remove the need for handling an error case that can never happen (if there is a From impl, the Error case of the TryFrom impl is Infallible.
Error
Infallible
No response
let a: u32 = 32; let b: Result<u64, Infaillible> = a.try_into();
Could be written as:
let a: u32 = 32; let b: u64 = a.into();
The text was updated successfully, but these errors were encountered:
@rustbot claim
Sorry, something went wrong.
unnecessary_fallible_conversions
7d34406
y21
Successfully merging a pull request may close this issue.
What it does
This lint would warn against using
try_into
from theTryInto
orTryFrom
trait when there is an availableInto
orFrom
implementation.Advantage
Remove the need for handling an error case that can never happen (if there is a
From
impl, theError
case of theTryFrom
impl isInfallible
.Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: