From 5552358158e7a2987fd06c3ce8474767367e9378 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 18 Dec 2019 15:16:22 -0800 Subject: [PATCH] Replace the scratch buffer with a temporary buffer. --- crates/wasi-common/src/sandboxed_tty_writer.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/wasi-common/src/sandboxed_tty_writer.rs b/crates/wasi-common/src/sandboxed_tty_writer.rs index 31e2d9d5250a..3c37f7435f09 100644 --- a/crates/wasi-common/src/sandboxed_tty_writer.rs +++ b/crates/wasi-common/src/sandboxed_tty_writer.rs @@ -9,10 +9,6 @@ where Writer: Write, { inner: &'writer mut Writer, - - /// Temporary buffer for holding UTF-8 encodings of `char`s, which - /// are at most 4 bytes long. - scratch: [u8; 4], } impl<'writer, Writer> SandboxedTTYWriter<'writer, Writer> @@ -23,7 +19,6 @@ where pub(crate) fn new(inner: &'writer mut Writer) -> Self { Self { inner, - scratch: [0; 4], } } @@ -67,7 +62,7 @@ where x if x.is_control() => '�', x => x, } - .encode_utf8(&mut [0; 4]) + .encode_utf8(&mut [0; 4]) // UTF-8 encoding of a `char` is at most 4 bytes. .as_bytes(), )?;