Poor naming of read()/write() I/O methods

I agree that it's a footgun. It would be nice to have a clippy lint that detects cases where the count returned by read/write is discarded. Renaming and deprecating an std method is not fast, and adding a clippy lint would be immediately benefitial. I'm not sure how easy it is, though: in addition to simple cases like io.write(slice)?;, you can also write if let Err(err) = io.write(slice) or match against Ok(_), etc.

7 Likes