diff --git a/lang/src/fmt.rs b/lang/src/fmt.rs index dcdba411..2468064e 100644 --- a/lang/src/fmt.rs +++ b/lang/src/fmt.rs @@ -3,7 +3,7 @@ use { lexer::{self, Lexer, TokenKind}, parser::{self, CommentOr, CtorField, Expr, Poser, Radix, StructField}, }, - core::fmt, + core::fmt::{self}, }; pub fn display_radix(radix: Radix, mut value: u64, buf: &mut [u8; 64]) -> &str { @@ -263,6 +263,20 @@ impl<'a> Formatter<'a> { }, ) } + Expr::Tupl { + pos, + ty: Some(&Expr::Slice { pos: spos, size: Some(&Expr::Number { value, .. }), item }), + fields, + trailing_comma, + } if value as usize == fields.len() => self.fmt( + &Expr::Tupl { + pos, + ty: Some(&Expr::Slice { pos: spos, size: None, item }), + fields, + trailing_comma, + }, + f, + ), Expr::Tupl { ty, fields, trailing_comma, .. } => { if let Some(ty) = ty { self.fmt_paren(ty, f, unary)?; diff --git a/lang/src/parser.rs b/lang/src/parser.rs index 0712d113..3a89ce2d 100644 --- a/lang/src/parser.rs +++ b/lang/src/parser.rs @@ -155,9 +155,7 @@ impl<'a, 'b> Parser<'a, 'b> { fn bin_expr(&mut self, mut fold: Expr<'a>, min_prec: u8, top_level: bool) -> Option> { loop { - let Some(prec) = self.token.kind.precedence() else { - break; - }; + let Some(prec) = self.token.kind.precedence() else { break }; if prec <= min_prec { break;