io: Add code comment to feature gate

This feature gate requires a little thought to understand, add a code
comment to save the next guy some clock cycles.
This commit is contained in:
Tobin C. Harding 2024-01-18 08:02:39 +11:00
parent 4cf2bf4b40
commit 2810b08b0d
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -161,7 +161,7 @@ impl<R: std::io::BufRead + Read + ?Sized> BufRead for R {
fn consume(&mut self, amount: usize) { std::io::BufRead::consume(self, amount) } fn consume(&mut self, amount: usize) { std::io::BufRead::consume(self, amount) }
} }
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))] // Conflicts with blanket impl when "std" is enabled.
impl Read for &[u8] { impl Read for &[u8] {
#[inline] #[inline]
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
@ -172,7 +172,7 @@ impl Read for &[u8] {
} }
} }
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))] // Conflicts with blanket impl when "std" is enabled.
impl BufRead for &[u8] { impl BufRead for &[u8] {
#[inline] #[inline]
fn fill_buf(&mut self) -> Result<&[u8]> { Ok(self) } fn fill_buf(&mut self) -> Result<&[u8]> { Ok(self) }