From 396a36bc92241edcfdd7c3abd1a5bed2347c4be4 Mon Sep 17 00:00:00 2001 From: Jonathan Morley Date: Thu, 18 May 2023 12:26:24 -0400 Subject: [PATCH] add an extra space for padding on the first line --- examples/no-indent.stdout | 42 +++++++++++++++++++-------------------- src/format.rs | 1 + 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/examples/no-indent.stdout b/examples/no-indent.stdout index c883bee..1339211 100644 --- a/examples/no-indent.stdout +++ b/examples/no-indent.stdout @@ -1,21 +1,21 @@ -1:mainno_indent::hierarchical-example version=0.1 -1:main no_indent::server host="localhost", port=8080 -1:main Xms INFO no_indent starting -1:main Xms INFO no_indent listening -1:main no_indent::conn peer_addr="82.9.9.9", port=42381 -1:main Xms DEBUG no_indent connected -1:main Xms DEBUG no_indent message received, length=2 -1:main no_indent::conn peer_addr="8.8.8.8", port=18230 -1:main Xms DEBUG no_indent connected -1:main no_indent::foomp 42 <- format string, normal_var=43 -1:main Xms ERROR no_indent hello -1:main no_indent::conn peer_addr="82.9.9.9", port=42381 -1:main Xms WARN no_indent weak encryption requested, algo="xor" -1:main Xms DEBUG no_indent response sent, length=8 -1:main Xms DEBUG no_indent disconnected -1:main no_indent::conn peer_addr="8.8.8.8", port=18230 -1:main Xms DEBUG no_indent message received, length=5 -1:main Xms DEBUG no_indent response sent, length=8 -1:main Xms DEBUG no_indent disconnected -1:main Xs WARN no_indent internal error -1:main Xs INFO no_indent exit +1:main no_indent::hierarchical-example version=0.1 +1:main no_indent::server host="localhost", port=8080 +1:main Xms INFO no_indent starting +1:main Xms INFO no_indent listening +1:main no_indent::conn peer_addr="82.9.9.9", port=42381 +1:main Xms DEBUG no_indent connected +1:main Xms DEBUG no_indent message received, length=2 +1:main no_indent::conn peer_addr="8.8.8.8", port=18230 +1:main Xms DEBUG no_indent connected +1:main no_indent::foomp 42 <- format string, normal_var=43 +1:main Xms ERROR no_indent hello +1:main no_indent::conn peer_addr="82.9.9.9", port=42381 +1:main Xms WARN no_indent weak encryption requested, algo="xor" +1:main Xms DEBUG no_indent response sent, length=8 +1:main Xms DEBUG no_indent disconnected +1:main no_indent::conn peer_addr="8.8.8.8", port=18230 +1:main Xms DEBUG no_indent message received, length=5 +1:main Xms DEBUG no_indent response sent, length=8 +1:main Xms DEBUG no_indent disconnected +1:main Xs WARN no_indent internal error +1:main Xs INFO no_indent exit diff --git a/src/format.rs b/src/format.rs index 47f8b1a..aa56178 100644 --- a/src/format.rs +++ b/src/format.rs @@ -418,6 +418,7 @@ fn indent_block( let indent_str = String::from(" ").repeat(indent_spaces); for line in lines { buf.push_str(prefix); + buf.push(' '); buf.push_str(&indent_str); buf.push_str(line); buf.push('\n');