-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
eq_op: allow optionally check fn calls #13828
base: master
Are you sure you want to change the base?
Conversation
Okay, to test lint with config i need to place it into tests/ui-toml as other tests, but should i copypaste full tests for this lint (from tests/ui)? |
Just allowing all function calls is not a great way to do this. You'll need some way kind of heuristic to determine whether the function is pure or not. You can use this as a rough example: rust-clippy/clippy_lints/src/operators/float_cmp.rs Lines 130 to 190 in 847e7d6
I would move the whole test over and use multiple revisions. You can use the |
This is actual intent to find all places with calls, so user can review them manually, rather than have some heuristic. I've checked top 200 crates via lintcheck and found 0 hits for eq_op lint, plus, it is disabled by default. See also linked issue for examples. One FP over rustc compiler code. |
Reasonable heuristics would catch the case you gave as an example. Given that it is, in all likelihood, possible to make a heuristic that could be both enabled by default and catch almost all desired cases, I'm not convinced this configuration is worth adding. |
Add option to allow
eq_op
lint to check function calls too.changelog: [
eq_op
]: allow optionally check fn calls toofixes: #13827
TODO: cleanup test