You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggested clippy lint: "Needless use of Result (function never returns Err). Consider changing the return type to i32 ."
(Unsure if it should be "needless" or "unnecessary", see #2845)
Categories (optional)
clippy::complexity (code that does something simple but in a complex way)
The use of this lint would most often come up after refactoring some code, when a function that used to have a ? in it no longer thus, and so now never returns an error.
Removing unnecessary uses of Result makes your code cleaner and clearer.
Drawbacks
Sometimes the user wants to return a Result because they plan on adding a failure condition later.
Example
fnfoo() -> Result<i32,Error>{Ok(42)}
Could be written as:
fnfoo() -> i32{42}
The text was updated successfully, but these errors were encountered:
What it does
Suggested clippy lint: "Needless use of
Result
(function never returnsErr
). Consider changing the return type toi32
."(Unsure if it should be "needless" or "unnecessary", see #2845)
Categories (optional)
clippy::complexity
(code that does something simple but in a complex way)The use of this lint would most often come up after refactoring some code, when a function that used to have a
?
in it no longer thus, and so now never returns an error.Removing unnecessary uses of
Result
makes your code cleaner and clearer.Drawbacks
Sometimes the user wants to return a
Result
because they plan on adding a failure condition later.Example
Could be written as:
The text was updated successfully, but these errors were encountered: