From bebd1b1500af42b899d931b937b9a86ea4f0ceaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Sun, 19 Feb 2023 18:22:21 +0000 Subject: [PATCH] feat: improved vec write support --- build.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index cdbf1da1..6b7ee9cc 100644 --- a/build.rs +++ b/build.rs @@ -139,10 +139,15 @@ where T: std::fmt::Display, { let mut list_str = String::new(); + let mut is_first = true; for value in &vec { - list_str.push_str(format!("\"{}\", ", value).as_str()); + if is_first { + is_first = false; + } else { + list_str.push_str(", "); + } + list_str.push_str(format!("\"{}\"", value).as_str()); } - list_str.pop(); writeln!( file, "pub const {}: [{}; {}] = [{}];", -- GitLab