chiark / gitweb /
Clippy fix: use write_all to beep.
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 22:59:08 +0000 (22:59 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 6 Jan 2024 08:53:31 +0000 (08:53 +0000)
Clippy complains that I used stdout().write(), and although I checked
the error code, I didn't also check whether it had written the full
buffer or only part of it.

But it didn't notice that the buffer was one byte long!

src/tui.rs

index 9b6bab9f88e0696207c05a383d8ec9bc0a1c361d..52c90a28f0c04ff6b21042e97cea93d19c953732 100644 (file)
@@ -402,7 +402,7 @@ impl Tui {
     }
 
     fn beep() -> std::io::Result<()> {
-        stdout().write(b"\x07")?;
+        stdout().write_all(b"\x07")?;
         Ok(())
     }
 }