You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The indentation on this else if let is very confusing as it looks like the if else ends because we are at "normal" indentation for statements in the body, which makes it look like someone has written an assignment with a pattern with a leading | which is then somehow followed up by a block with an else on the end of it (?)
Something like the following would be significantly clearer as the indentation signifies that this is inside of the else condition:
Relatedly consider the following two code examples:
else ifletNode::TraitItem(&TraitItem{kind:TraitItemKind::Fn(..),}) | Node::ForeignItem(&ForeignItem{kind:ForeignItemKind::Fn(..),}) = tcx.hir_node(){
x
}
and
else ifNode::trait_item(){TraitItemKind::Fn(..),}elseifletNode::ForeignItem(&ForeignItem{kind:ForeignItemKind::Fn(..),}) = tcx.hir_node(){
x
}
The former has incredibly similar structure to the latter despite having incredibly different meaning and the only distinction is | let which is very easy to miss when skimming the code.
The indentation on this
else if let
is very confusing as it looks like theif else
ends because we are at "normal" indentation for statements in the body, which makes it look like someone has written an assignment with a pattern with a leading|
which is then somehow followed up by a block with an else on the end of it (?)Something like the following would be significantly clearer as the indentation signifies that this is inside of the
else
condition:The text was updated successfully, but these errors were encountered: