-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Missing some warnings about "literal out of range for its type" #14165
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This same logic applies to It is arguable as to whether these cases should produce an |
But
An appropriate warning for those would be something like "warning: casting a negative literal to an unsigned type". And this following case in my original post should clearly cause a
...given that the following does:
|
Saying Which is to say, Same thing with |
I suppose But the following is clearly an implicit cast, and thus should warrant a warning:
And the warning shouldn't be the |
Of course, I can only speculate. I didn't implement the lint. But my feeling is that |
Hi, I wrote the lint for the unsigned negation and wanted to catch the obvious cases negating unsigned literals. A related issue to the case @tommit mentioned is #5477. |
Duplicate of #5477. |
internal: Make CompletionItem more POD-like
…or_else()` (rust-lang#14165) These method chains can be expressed concisely with `if`/`else`. changelog: [`obfuscated_if_else`]: support `then().unwrap_or_else()` and `then_some().unwrap_or_else()`
The places I'd expect to get warnings are indicated by the comments in this example:
Here's the compiler output:
And here's the program output:
232, 232, 232, 232, 255, 1, 0
The text was updated successfully, but these errors were encountered: