The Reading memory mapped text files example actually pessimizes the case where a non-GZipped file is being read. It's only necessary to do this for flate2::bufread::GzDecoder, and not the &[u8] that's being given by the expression &mmap[..]; &[u8] already implements BufRead!
For further fun, you might be interested in eliminating the unnecessary Boxing done here tool using @llogiq's stack allocation trick, but I can see how that might hurt the example's readability.
The `Reading memory mapped text files` example actually _pessimizes_ the case where a non-GZipped file is being read. It's only necessary to do this for `flate2::bufread::GzDecoder`, and not the `&[u8]` that's being given by the expression `&mmap[..]`; `&[u8]` already [implements][docs] `BufRead`!
[docs]: https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#implementors
---
For further fun, you might be interested in eliminating the unnecessary `Box`ing done here tool using [@llogiq's stack allocation trick](https://llogiq.github.io/2020/03/14/ootb.html), but I can see how that might hurt the example's readability.