derive: don't write empty string

This commit is contained in:
René Kijewski 2024-08-13 04:27:40 +02:00
parent 871215b529
commit 68327f1a36

View File

@ -2284,7 +2284,7 @@ impl Buffer {
const OPEN: &str = r#"writer.write_str(""#;
const CLOSE: &str = r#"")?;"#;
if !self.discard {
if !s.is_empty() && !self.discard {
if !self.last_was_write_str {
self.last_was_write_str = true;
self.buf.push_str(OPEN);