commit a5a4b7c79bd19e7d4e471cc873d01cadae0cfc6a
parent a22dee2b8ad1a33f6cd8c9829c9d6b98deb6df98
Author: Alexey Yerin <yyp@disroot.org>
Date: Wed, 30 Mar 2022 14:13:32 +0300
cmd/haredoc: only allocate a buffer for unparse::_type when brief is set
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha
@@ -557,10 +557,10 @@ fn type_html(
_type: ast::_type,
brief: bool,
) (size | io::error) = {
- let buf = strio::dynamic();
- defer io::close(&buf);
- unparse::_type(&buf, indent, _type)?;
if (brief) {
+ let buf = strio::dynamic();
+ defer io::close(&buf);
+ unparse::_type(&buf, indent, _type)?;
return html_escape(out, strio::string(&buf))?;
};