Skip to content

Commit 2b3f26f

Browse files
committed
perf(fmt): Avoid UTF-8 validation
1 parent 7428386 commit 2b3f26f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fmt/writer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ impl WritableTarget {
6868
match self {
6969
WritableTarget::WriteStdout => {
7070
let mut stream = std::io::stdout().lock();
71-
write!(stream, "{}", String::from_utf8_lossy(buf))?;
71+
stream.write_all(buf)?;
7272
}
7373
WritableTarget::PrintStdout => print!("{}", String::from_utf8_lossy(buf)),
7474
WritableTarget::WriteStderr => {
7575
let mut stream = std::io::stderr().lock();
76-
write!(stream, "{}", String::from_utf8_lossy(buf))?;
76+
stream.write_all(buf)?;
7777
}
7878
WritableTarget::PrintStderr => eprint!("{}", String::from_utf8_lossy(buf)),
7979
// Safety: If the target type is `Pipe`, `target_pipe` will always be non-empty.
8080
WritableTarget::Pipe(pipe) => {
8181
let mut stream = pipe.lock().unwrap();
82-
write!(stream, "{}", String::from_utf8_lossy(buf))?;
82+
stream.write_all(buf)?;
8383
}
8484
}
8585

0 commit comments

Comments
 (0)