-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
False positive in UnusedOptionalBindingRule #1432
Comments
I don't think this is necessarily a false positive. You could do this instead: guard try? alwaysThrow() != nil else { return } I don't think anyone thought about |
You need to wrap in parenthesis, I just forgot to do it. func alwaysThrow() throws {
}
guard (try? alwaysThrow()) != nil else { return } |
So, to silence that kind of warning, I better wrap every try? in parenthesis? Yeah, the code will be much cleaner, readable and safe. |
Well, I'd argue that I marked this as a discussion, so more people can jump in and share their thoughts. I'd like to say:
|
Right now I had to disable the rule in the config, 'cause I don't want to put too much of
I believe, that UnusedOptionalBindingRule better either be split in two rules (the one for unused Anyway, the parenthesis option is useless: it does the same thing, but without let. You still have |
Feel free to send a PR with implementing this as a configuration or splitting into a new rule! 💯 |
@marcelofabri, I need some help with the tests in script/cibuild. |
Closed in #1480 |
This warning is triggered when using the try? syntax for error handling.
The text was updated successfully, but these errors were encountered: