From 373a4a26c4c8a657b77d16d2efcc8dc8ea8ad069 Mon Sep 17 00:00:00 2001 From: "Levy A." Date: Fri, 4 Jul 2025 00:41:38 -0300 Subject: [PATCH] fix: comma function --- core/translate/display.rs | 2 +- vendored/sqlite3-parser/src/parser/ast/fmt.rs | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/core/translate/display.rs b/core/translate/display.rs index b4067fb99..88a3595ec 100644 --- a/core/translate/display.rs +++ b/core/translate/display.rs @@ -567,7 +567,7 @@ impl ToTokens for UpdatePlan { s.comma( order_by.iter().map(|(expr, order)| ast::SortedColumn { expr: expr.clone(), - order: Some(order.clone()), + order: Some(*order), nulls: None, }), context, diff --git a/vendored/sqlite3-parser/src/parser/ast/fmt.rs b/vendored/sqlite3-parser/src/parser/ast/fmt.rs index 1bda031a3..cea1b42f8 100644 --- a/vendored/sqlite3-parser/src/parser/ast/fmt.rs +++ b/vendored/sqlite3-parser/src/parser/ast/fmt.rs @@ -104,7 +104,7 @@ pub trait TokenStream { type Error; /// Push token to this stream fn append(&mut self, ty: TokenType, value: Option<&str>) -> Result<(), Self::Error>; - + /// Interspace iterator with commas fn comma(&mut self, items: I, context: &C) -> Result<(), Self::Error> where I: IntoIterator, @@ -2360,7 +2360,7 @@ impl ToTokens for FrameExclude { } } -pub fn comma( +fn comma( items: I, s: &mut S, context: &C, @@ -2369,14 +2369,7 @@ where I: IntoIterator, I::Item: ToTokens, { - let iter = items.into_iter(); - for (i, item) in iter.enumerate() { - if i != 0 { - s.append(TK_COMMA, None)?; - } - item.to_tokens_with_context(s, context)?; - } - Ok(()) + s.comma(items, context) } // TK_ID: [...] / `...` / "..." / some keywords / non keywords