diff options
author | Azul <azul@riseup.net> | 2020-12-11 14:41:57 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2020-12-11 18:09:09 +0100 |
commit | e3d65e26e284b7a77af9f3b713790f8a98bc417f (patch) | |
tree | fc7c363c357f1ce7bd80f5646f4b054f2c468b9b /openpgp/src/fmt.rs | |
parent | 90105c50559da50d7e601dca6a27040e03e430a1 (diff) |
openpgp: Replace `.unwrap()` in doctests with `?`
- See #480.
Diffstat (limited to 'openpgp/src/fmt.rs')
-rw-r--r-- | openpgp/src/fmt.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/openpgp/src/fmt.rs b/openpgp/src/fmt.rs index 783c1885..1921a784 100644 --- a/openpgp/src/fmt.rs +++ b/openpgp/src/fmt.rs @@ -40,20 +40,22 @@ pub mod hex { /// # Examples /// /// ```rust - /// use sequoia_openpgp::fmt::hex; + /// # f().unwrap(); fn f() -> sequoia_openpgp::Result<()> { + /// use sequoia_openpgp::fmt::hex; /// /// let mut dumper = hex::Dumper::new(Vec::new(), ""); - /// dumper.write(&[0x89, 0x01, 0x33], "frame").unwrap(); - /// dumper.write(&[0x04], "version").unwrap(); - /// dumper.write(&[0x00], "type").unwrap(); + /// dumper.write(&[0x89, 0x01, 0x33], "frame")?; + /// dumper.write(&[0x04], "version")?; + /// dumper.write(&[0x00], "type")?; /// /// let buf = dumper.into_inner(); /// assert_eq!( - /// ::std::str::from_utf8(&buf[..]).unwrap(), + /// ::std::str::from_utf8(&buf[..])?, /// "00000000 89 01 33 frame\n\ /// 00000003 04 version\n\ /// 00000004 00 type\n\ /// "); + /// # Ok(()) } /// ``` pub struct Dumper<W: io::Write> { inner: W, |