-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Simplify key in dct and dct[key]
to dct.get(key)
#5933
Comments
Hi could I work on this? |
Hi @agnes-sharan -- thanks for asking! We need to make a decision as maintainers on whether to include this (and how it should be categorized) before opening it up for contributors. We'll label it as such and comment here when there's consensus. |
Examples in the wild: https://grep.app/search?q=%20%22%28.%2B%29%22%20in%20%5Ba-z0-9%5D%2B%20and%20%5Ba-z0-9%5D%2B%5C%5B%22%28.%2B%29%22%5C%5D%3A®exp=true It would make sense to propose this rule in |
key in dict
check before access to dict.get
key in dct and dct[key]
to dct.get(key)
The regex can be made more generic to increase the number of hits. The site doesn't seem to support backreferences |
Refurb might be a candidate to include this rule into: https://github.com/dosisod/refurb In the cases that Alternatively, this could be a RUF category rule. |
We can add this as a |
@charliermarsh can I work on this? |
Go for it! |
How would you name this rule? |
We may need to limit this to boolean tests, since it returns |
I'm not sure, maybe like |
## Summary Close #5933 ## Test Plan `cargo test`
The text was updated successfully, but these errors were encountered: