about summary refs log tree commit diff
path: root/library/core/src/fmt
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2024-12-20 17:02:46 +0000
committerKornel <kornel@geekhood.net>2024-12-21 01:26:47 +0000
commit7b42bc0c7935e9f5fefd017249041d64f27bb583 (patch)
tree5b65fd21829609d725f852c11e141aa59573e349 /library/core/src/fmt
parent5f23ef7d3f7a8c3e0ca5c4e1978829c0448a3686 (diff)
Less unwrap() in documentation
Diffstat (limited to 'library/core/src/fmt')
-rw-r--r--library/core/src/fmt/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 14c70065101..c2c78dd9c67 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -152,8 +152,9 @@ pub trait Write {
     /// }
     ///
     /// let mut buf = String::new();
-    /// writer(&mut buf, "hola").unwrap();
+    /// writer(&mut buf, "hola")?;
     /// assert_eq!(&buf, "hola");
+    /// # std::fmt::Result::Ok(())
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn write_str(&mut self, s: &str) -> Result;
@@ -179,9 +180,10 @@ pub trait Write {
     /// }
     ///
     /// let mut buf = String::new();
-    /// writer(&mut buf, 'a').unwrap();
-    /// writer(&mut buf, 'b').unwrap();
+    /// writer(&mut buf, 'a')?;
+    /// writer(&mut buf, 'b')?;
     /// assert_eq!(&buf, "ab");
+    /// # std::fmt::Result::Ok(())
     /// ```
     #[stable(feature = "fmt_write_char", since = "1.1.0")]
     fn write_char(&mut self, c: char) -> Result {
@@ -208,8 +210,9 @@ pub trait Write {
     /// }
     ///
     /// let mut buf = String::new();
-    /// writer(&mut buf, "world").unwrap();
+    /// writer(&mut buf, "world")?;
     /// assert_eq!(&buf, "world");
+    /// # std::fmt::Result::Ok(())
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn write_fmt(&mut self, args: Arguments<'_>) -> Result {