-
Notifications
You must be signed in to change notification settings - Fork 31
feat: detect useless parens in binops #98
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
base: master
Are you sure you want to change the base?
Conversation
|
Hey, if you rebase I'll review. |
7ae23d0 to
a1fa246
Compare
|
What do you think about incorporating this function from nil? https://github.com/oxalica/nil/blob/f80fe365cb441624d1608235e6e793e5dce47fb0/crates/syntax/src/ast.rs#L268-L332 I think it would be nice to be able to handle more than just function applications in binops. Thank you for your time :) |
|
Sorry, I think #138 is the priority so we've been working on that. |
|
Now that we have #138 would you mind rebasing (again, sorry)? |
|
Sure, I'll do it when I have time, maybe this weekend. Thanks :) |
|
@mightyiam I noticed that there are quite some tests all test on the $ rg -F "rule: manual_inherit" -c
bin/tests/useless_parens.rs:1
bin/tests/unquoted_uri.rs:1
bin/tests/empty_inherit.rs:1
bin/tests/deprecated_to_path.rs:1
bin/tests/collapsible_let_in.rs:1
bin/tests/manual_inherit.rs:1
bin/tests/eta_reduction.rs:1
bin/tests/empty_pattern.rs:1
bin/tests/redundant_pattern_bind.rs:1
bin/tests/legacy_let_syntax.rs:1
bin/tests/manual_inherit_from.rs:1For I'll need to debug a bit since the rnix crate has been updated and the rules I wrote are no longer matching. I tried to run Thank you for your time! |
Yes, sorry. Corrected.
I think the only thing this has affect on is the identifier of the test fn. That, in turn, rarely affects anything else.
The tests are CLI tests, so those It should be possible to use Another thing we could do is add some explicit "sanity check" CLI tests that have to do with no rule in particular and then convert the implementation of the rule-specific tests to not be end-to-end (testing the behavior of the process) but to be unit tests, testing a private function. Of course, this raises some questions. Let me know whether you'd like to get into that. |
Related to #14
Currently it only checks for functions in binops, other kinds of detection (e.g., associativity) are to be discussed.
Would it be reasonable to contribute to upstream and implement
OrdorPartialOrdso that we could compare the precedence of different syntax nodes?Related CPPNix documentation: https://nix.dev/manual/nix/2.29/language/operators