1
Fork 0

add guard pattern AST node

This commit is contained in:
Max Niederman 2024-08-22 16:49:45 -07:00 committed by Nadrieril
parent 35bbc45f16
commit 9b8bfed73b
7 changed files with 26 additions and 4 deletions

View file

@ -1709,6 +1709,12 @@ impl<'a> State<'a> {
self.print_expr(e, FixupContext::default());
}
}
PatKind::Guard(subpat, condition) => {
self.print_pat(subpat);
self.space();
self.word_space("if");
self.print_expr(condition, FixupContext::default());
}
PatKind::Slice(elts) => {
self.word("[");
self.commasep(Inconsistent, elts, |s, p| s.print_pat(p));