clean up example on read_to_string

This is the same thing, but simpler.
This commit is contained in:
Steve Klabnik 2021-04-10 12:50:04 -05:00 committed by GitHub
parent 4029d4d0be
commit c2f4a5b9f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,8 +265,9 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
/// ```no_run /// ```no_run
/// use std::fs; /// use std::fs;
/// use std::net::SocketAddr; /// use std::net::SocketAddr;
/// use std::error::Error;
/// ///
/// fn main() -> Result<(), Box<dyn std::error::Error + 'static>> { /// fn main() -> Result<(), Box<dyn Error>> {
/// let foo: SocketAddr = fs::read_to_string("address.txt")?.parse()?; /// let foo: SocketAddr = fs::read_to_string("address.txt")?.parse()?;
/// Ok(()) /// Ok(())
/// } /// }