I am initializing buf unnecessarily with all zeros before immediately writing over its contents with read_exact:
fn parse<R: Read>(r: &mut R) -> Result<()> {
let mut buf = [0u8; 1024];
r.read_exact(&mut buf)?;
// Do things to buf
Ok(true)
}
While I don't think the 0-initialization is very time-consuming, it doesn't seem necessary. Is there a way around this?