-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add manual_ignore_cast_cmp lint #13334
base: master
Are you sure you want to change the base?
Conversation
☔ The latest upstream changes (presumably #13247) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid start, let me know if anything is unclear :D
let ty = ty_raw.peel_refs(); | ||
if needs_ref_to_cmp(cx, ty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain these lines?
They feel a bit weird. The peel_refs
removes all potential references from the type, which means that some ascii types will fail the needs_ref_to_cmp
function even if ty_raw
would pass it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xFrednet what's the better way to do this comparison?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was thinking some more on this, and tried to come up with a unit test that would fail, but was not able to do that... are you certain this is an issue?
fn unsupported(a: char, b: char) { | ||
// TODO:: these are rare, and might not be worth supporting | ||
a.to_ascii_lowercase() == char::to_ascii_lowercase(&b); | ||
char::to_ascii_lowercase(&a) == b.to_ascii_lowercase(); | ||
char::to_ascii_lowercase(&a) == char::to_ascii_lowercase(&b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really worth supporting. I would expect them to still trigger the lint though 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki, will keep them as part of tests to track progress if they ever change, but won't fix them in the lint
☔ The latest upstream changes (presumably #12987) made this pull request unmergeable. Please resolve the merge conflicts. |
f1d859e
to
c4f6a20
Compare
☔ The latest upstream changes (presumably #13322) made this pull request unmergeable. Please resolve the merge conflicts. |
c4f6a20
to
b86410e
Compare
.stderr
file)cargo test
passes locallycargo dev update_lints
cargo dev fmt
Closes #13204