Merge pull request #228 from g2p/non-utf8-printbuf-display

printbuf_to_formatter: Lossy display of non-UTF-8 printbufs
This commit is contained in:
koverstreet 2024-01-29 12:19:16 -05:00 committed by GitHub
commit f2f1b5c3ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,5 +164,5 @@ pub fn printbuf_to_formatter<F>(f: &mut fmt::Formatter<'_>, func: F) -> fmt::Res
func(&mut buf);
let s = unsafe { CStr::from_ptr(buf.buf) };
f.write_str(s.to_str().unwrap())
f.write_str(&s.to_string_lossy())
}