2023-11-26 automated rustfmt nightly
This commit is contained in:
		
							parent
							
								
									71d92bdbb9
								
							
						
					
					
						commit
						1c89e07537
					
				|  | @ -15,7 +15,6 @@ | ||||||
| 
 | 
 | ||||||
| // Experimental features we need.
 | // Experimental features we need.
 | ||||||
| #![cfg_attr(docsrs, feature(doc_auto_cfg))] | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ||||||
| 
 |  | ||||||
| #![cfg_attr(not(feature = "std"), no_std)] | #![cfg_attr(not(feature = "std"), no_std)] | ||||||
| 
 | 
 | ||||||
| #[cfg(any(feature = "alloc", feature = "std"))] | #[cfg(any(feature = "alloc", feature = "std"))] | ||||||
|  | @ -24,10 +23,10 @@ extern crate alloc; | ||||||
| /// Standard I/O stream definitions which are API-equivalent to `std`'s `io` module. See
 | /// Standard I/O stream definitions which are API-equivalent to `std`'s `io` module. See
 | ||||||
| /// [`std::io`] for more info.
 | /// [`std::io`] for more info.
 | ||||||
| pub mod io { | pub mod io { | ||||||
|     use core::convert::TryInto; |  | ||||||
|     use core::fmt::{Debug, Display, Formatter}; |  | ||||||
|     #[cfg(any(feature = "alloc", feature = "std"))] |     #[cfg(any(feature = "alloc", feature = "std"))] | ||||||
|     use alloc::boxed::Box; |     use alloc::boxed::Box; | ||||||
|  |     use core::convert::TryInto; | ||||||
|  |     use core::fmt::{Debug, Display, Formatter}; | ||||||
| 
 | 
 | ||||||
|     #[cfg(all(feature = "alloc", not(feature = "std")))] |     #[cfg(all(feature = "alloc", not(feature = "std")))] | ||||||
|     mod sealed { |     mod sealed { | ||||||
|  | @ -38,14 +37,10 @@ pub mod io { | ||||||
|             fn into(self) -> Box<dyn Debug + Send + Sync + 'static>; |             fn into(self) -> Box<dyn Debug + Send + Sync + 'static>; | ||||||
|         } |         } | ||||||
|         impl IntoBoxDynDebug for &str { |         impl IntoBoxDynDebug for &str { | ||||||
|             fn into(self) -> Box<dyn Debug + Send + Sync + 'static> { |             fn into(self) -> Box<dyn Debug + Send + Sync + 'static> { Box::new(String::from(self)) } | ||||||
|                 Box::new(String::from(self)) |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|         impl IntoBoxDynDebug for String { |         impl IntoBoxDynDebug for String { | ||||||
|             fn into(self) -> Box<dyn Debug + Send + Sync + 'static> { |             fn into(self) -> Box<dyn Debug + Send + Sync + 'static> { Box::new(self) } | ||||||
|                 Box::new(self) |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -71,9 +66,7 @@ pub mod io { | ||||||
|             Self { kind, error: Some(error.into()) } |             Self { kind, error: Some(error.into()) } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         pub fn kind(&self) -> ErrorKind { |         pub fn kind(&self) -> ErrorKind { self.kind } | ||||||
|             self.kind |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl From<ErrorKind> for Error { |     impl From<ErrorKind> for Error { | ||||||
|  | @ -219,9 +212,7 @@ pub mod io { | ||||||
|             Ok(()) |             Ok(()) | ||||||
|         } |         } | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn take(&mut self, limit: u64) -> Take<Self> { |         fn take(&mut self, limit: u64) -> Take<Self> { Take { reader: self, remaining: limit } } | ||||||
|             Take { reader: self, remaining: limit } |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub struct Take<'a, R: Read + ?Sized> { |     pub struct Take<'a, R: Read + ?Sized> { | ||||||
|  | @ -263,17 +254,11 @@ pub mod io { | ||||||
|     } |     } | ||||||
|     impl<T: AsRef<[u8]>> Cursor<T> { |     impl<T: AsRef<[u8]>> Cursor<T> { | ||||||
|         #[inline] |         #[inline] | ||||||
|         pub fn new(inner: T) -> Self { |         pub fn new(inner: T) -> Self { Cursor { inner, pos: 0 } } | ||||||
|             Cursor { inner, pos: 0 } |  | ||||||
|         } |  | ||||||
|         #[inline] |         #[inline] | ||||||
|         pub fn position(&self) -> u64 { |         pub fn position(&self) -> u64 { self.pos } | ||||||
|             self.pos |  | ||||||
|         } |  | ||||||
|         #[inline] |         #[inline] | ||||||
|         pub fn into_inner(self) -> T { |         pub fn into_inner(self) -> T { self.inner } | ||||||
|             self.inner |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     impl<T: AsRef<[u8]>> Read for Cursor<T> { |     impl<T: AsRef<[u8]>> Read for Cursor<T> { | ||||||
|         #[inline] |         #[inline] | ||||||
|  | @ -282,7 +267,9 @@ pub mod io { | ||||||
|             let start_pos = self.pos.try_into().unwrap_or(inner.len()); |             let start_pos = self.pos.try_into().unwrap_or(inner.len()); | ||||||
|             let read = core::cmp::min(inner.len().saturating_sub(start_pos), buf.len()); |             let read = core::cmp::min(inner.len().saturating_sub(start_pos), buf.len()); | ||||||
|             buf[..read].copy_from_slice(&inner[start_pos..start_pos + read]); |             buf[..read].copy_from_slice(&inner[start_pos..start_pos + read]); | ||||||
|             self.pos = self.pos.saturating_add(read.try_into().unwrap_or(u64::max_value() /* unreachable */)); |             self.pos = self | ||||||
|  |                 .pos | ||||||
|  |                 .saturating_add(read.try_into().unwrap_or(u64::max_value() /* unreachable */)); | ||||||
|             Ok(read) |             Ok(read) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | @ -313,9 +300,7 @@ pub mod io { | ||||||
|             Ok(<W as std::io::Write>::write(self, buf)?) |             Ok(<W as std::io::Write>::write(self, buf)?) | ||||||
|         } |         } | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn flush(&mut self) -> Result<()> { |         fn flush(&mut self) -> Result<()> { Ok(<W as std::io::Write>::flush(self)?) } | ||||||
|             Ok(<W as std::io::Write>::flush(self)?) |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     #[cfg(all(feature = "alloc", not(feature = "std")))] |     #[cfg(all(feature = "alloc", not(feature = "std")))] | ||||||
|  | @ -347,9 +332,7 @@ pub mod io { | ||||||
|     #[cfg(not(feature = "std"))] |     #[cfg(not(feature = "std"))] | ||||||
|     impl Write for Sink { |     impl Write for Sink { | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn write(&mut self, buf: &[u8]) -> Result<usize> { |         fn write(&mut self, buf: &[u8]) -> Result<usize> { Ok(buf.len()) } | ||||||
|             Ok(buf.len()) |  | ||||||
|         } |  | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn write_all(&mut self, _: &[u8]) -> Result<()> { Ok(()) } |         fn write_all(&mut self, _: &[u8]) -> Result<()> { Ok(()) } | ||||||
|         #[inline] |         #[inline] | ||||||
|  | @ -358,9 +341,7 @@ pub mod io { | ||||||
|     #[cfg(feature = "std")] |     #[cfg(feature = "std")] | ||||||
|     impl std::io::Write for Sink { |     impl std::io::Write for Sink { | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { |         fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { Ok(buf.len()) } | ||||||
|             Ok(buf.len()) |  | ||||||
|         } |  | ||||||
|         #[inline] |         #[inline] | ||||||
|         fn write_all(&mut self, _: &[u8]) -> std::io::Result<()> { Ok(()) } |         fn write_all(&mut self, _: &[u8]) -> std::io::Result<()> { Ok(()) } | ||||||
|         #[inline] |         #[inline] | ||||||
|  | @ -399,7 +380,6 @@ macro_rules! impl_write { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| #[macro_export] | #[macro_export] | ||||||
| /// Because we cannot provide a blanket implementation of [`std::io::Write`] for all implementers
 | /// Because we cannot provide a blanket implementation of [`std::io::Write`] for all implementers
 | ||||||
| /// of this crate's `io::Write` trait, we provide this macro instead.
 | /// of this crate's `io::Write` trait, we provide this macro instead.
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue