]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - bch_bindgen/src/lib.rs
printbuf_to_formatter: Lossy display of non-UTF-8 printbufs
[bcachefs-tools-debian] / bch_bindgen / src / lib.rs
index deb69a5169907124e6f19e9d5baa9e2c1b995cf2..ea49e60beed35b548d3d7c50b4a3fd4eaf2c0ebf 100644 (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())
 }