]> git.lizzy.rs Git - rust.git/commitdiff
simplify assertions
authorAndy Russell <arussell123@gmail.com>
Wed, 11 Jul 2018 18:39:22 +0000 (14:39 -0400)
committerAndy Russell <arussell123@gmail.com>
Wed, 11 Jul 2018 18:39:22 +0000 (14:39 -0400)
src/libstd/io/buffered.rs

index ed085d5c0df8ef87e298009aa4ff6db4275197b6..189569683a9cf78fad5f243f5e33afc1057e48e3 100644 (file)
@@ -756,11 +756,11 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 ///
 ///     // No bytes are written until a newline is encountered (or
 ///     // the internal buffer is filled).
-///     assert_eq!(fs::read_to_string("poem.txt")?.as_bytes(), b"");
+///     assert_eq!(fs::read_to_string("poem.txt")?"");
 ///     file.write_all(b"\n")?;
 ///     assert_eq!(
-///         fs::read_to_string("poem.txt")?.as_bytes(),
-///         &b"I shall be telling this with a sigh\n"[..],
+///         fs::read_to_string("poem.txt")?,
+///         "I shall be telling this with a sigh\n",
 ///     );
 ///
 ///     // Write the rest of the poem.
@@ -775,8 +775,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 ///     file.flush()?;
 ///
 ///     // Confirm the whole poem was written.
-///     let mut poem = fs::read_to_string("poem.txt")?;
-///     assert_eq!(poem.as_bytes(), &road_not_taken[..]);
+///     assert_eq!(fs::read("poem.txt")?, &road_not_taken[..]);
 ///     Ok(())
 /// }
 /// ```