Skip to content

Commit 9c34cbf

Browse files
authored
Rollup merge of #84067 - rust-lang:steveklabnik-patch-1, r=joshtriplett
clean up example on read_to_string This is the same thing, but simpler. This came out of a comment from a user: https://news.ycombinator.com/item?id=25318117 but rather than hide the signature of main, I think a `use` plus not including the `'static` makes more sense.
2 parents 58f32da + c2f4a5b commit 9c34cbf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/std/src/fs.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,9 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
265265
/// ```no_run
266266
/// use std::fs;
267267
/// use std::net::SocketAddr;
268+
/// use std::error::Error;
268269
///
269-
/// fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
270+
/// fn main() -> Result<(), Box<dyn Error>> {
270271
/// let foo: SocketAddr = fs::read_to_string("address.txt")?.parse()?;
271272
/// Ok(())
272273
/// }

0 commit comments

Comments
 (0)