-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Tracking Issue: lints that lint against match
and if-let
s should be more consistent
#12618
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
Comments
(somewhat) related to the discussion in #12610 |
Am i reproducing this issue correctly?
if we use
on this code, it shows no warning or error while it should be suggesting us to use unwrap_or () . |
Yeah, except it should be some other value except |
Lint `manual_unwrap_or_default` for Result as well This PR is modifying the `manual_unwrap_or_default` to be applied/linted for `Result`s as well. It is part of the fixes desired by #12618 changelog:[`manual_unwrap_or_default`]: Lint for Result types.
@J-ZhengLi , I think that github.com//pull/12897 fixed the second point of the table :) I will try to take a look on the first point as well in the next few days, since it would be similar to what I already did. |
Lint `manual_unwrap_or` for it let cases This PR modifies `manual_unwrap_or` to lint for `if let` cases as well. This effort is part of the fixes desired by #12618 changelog:[`manual_unwrap_or`]: Lint for `if let` cases.
Does this issue still need to be worked on? I'd like to contribute if so. |
Uh oh!
There was an error while loading. Please reload this page.
Description
there are lints that check (or at least should be checking) for
match
orif-let
onOption
orResult
, such as [question_mark
], which checks all combinations now.But there are some lints that either checks only
match
exprs onOption
andResult
, or checksmatch
andif-let
onOption
s, which does not seems consistent, consider the same rules could be applied for both.Here is a short list of lints that I found which has this problem (I didn't went into it enough so it's highly possible there are missing some lint, ping me to add them in):
manual_unwrap_or
if-let
expressionsmanual_unwrap_or_default
Result
typemanual_let_else
(somewhat belongs to this list... I think)Result
type(The
pat_and_expr_can_be_question_mark
could use some improvement, since not onlyOption
s can use question mark, any types that implsTry
trait can use it, likeResult
ofc)Not in the list but could someone plz confirm that the problem which [
if_let_mutex
] trying to prevent can or cannot happen withmatch
?Version
No response
Additional Labels
@rustbot label +I-false-nagative +C-enhancement +good-first-issue
The text was updated successfully, but these errors were encountered: