-
Notifications
You must be signed in to change notification settings - Fork 954
Open
Labels
Description
From rust-lang/rust-clippy#4123 (comment):
F: FnMut(&ast::Block, Option<&ast::Label>),
{
if let ast::ExprKind::While(_, loop_block, label)
- | ast::ExprKind::ForLoop(_, _, loop_block, label)
- | ast::ExprKind::Loop(loop_block, label)
- = &expr.node
+ | ast::ExprKind::ForLoop(_, _, loop_block, label)
+ | ast::ExprKind::Loop(loop_block, label) = &expr.node
{
func(loop_block, label.as_ref());
}
In this case,
- Should we add indentation to each clause that appears after the first one?
- Should we keep the expression (
&expr.node
) on the same line as the last clause, or put it on the next line?
Note that for multi-lined patterns of match's arm, rustfmt does not add indentation.
match some_value {
ast::ExprKind::While(_, loop_block, label)
| ast::ExprKind::ForLoop(_, _, loop_block, label)
| ast::ExprKind::Loop(loop_block, label) = &expr.node
=> {
// ...
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
rchaser53 commentedon Jun 24, 2019
I think that the pattern like multi-lined patterns of match's arm is good.
ytmimi commentedon Jul 20, 2022
confirming I can reproduce this behavior with
rustfmt 1.5.1-nightly (f2c31ba0 2022-07-19)
Input
Output