fix(assists/replace_match_with_if_let): don't parenthesize if-let guards#22618
fix(assists/replace_match_with_if_let): don't parenthesize if-let guards#22618ada4a wants to merge 3 commits into
Conversation
| } | ||
|
|
||
| #[test] | ||
| fn test_replace_match_with_if_let_with_if_let_guard() { |
There was a problem hiding this comment.
Those names are getting ridiculously long imo... What do you all think about having replace_match_with_if_let be a submodule of tests, so that all the tests for that don't need to repeat it in the name? This would make the test suite more structured imo, at the cost of some rightward drift
35d1adf to
2534980
Compare
2534980 to
78c94bb
Compare
The next commit is going to add a bigger test, so I figured it's time to collect all of them at the end of the file.
03f2dbd to
88d34da
Compare
|
You'd think |
| /// body | ||
| /// } | ||
| /// ``` | ||
| /// won't compile. |
There was a problem hiding this comment.
Redundant documents
| } | ||
| } | ||
|
|
||
| guard.precedence().needs_parentheses_in(ast::prec::ExprPrecedence::LAnd) && !has_let_expr(guard) |
There was a problem hiding this comment.
Please use Expr::needs_parens_in_place_of
And if has_let_expr is still needed, then it should be in prec.rs instead of utils.rs
There was a problem hiding this comment.
Please use
Expr::needs_parens_in_guard_chain
No such method exists? Or do you mean I should turn this function into a method on Expr?
There was a problem hiding this comment.
Sorry typo, is Expr::needs_parens_in_place_of
| } | ||
|
|
||
| #[test] | ||
| fn test_needs_parens_in_guard_chain() { |
There was a problem hiding this comment.
No need to test this function
Parenthesizing added in #21937, cc @A4-Tacks