From 76eca8d9996cd96751a1ab8a0e7577bff967fd6a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 17 Nov 2023 14:43:25 +0100 Subject: [PATCH] uucore/format: fix doctests --- src/uucore/src/lib/features/format/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uucore/src/lib/features/format/mod.rs b/src/uucore/src/lib/features/format/mod.rs index 7417d48fa..47e6fa4cc 100644 --- a/src/uucore/src/lib/features/format/mod.rs +++ b/src/uucore/src/lib/features/format/mod.rs @@ -194,9 +194,9 @@ fn parse_escape_only(fmt: &[u8]) -> impl Iterator + '_ { /// # Examples /// /// ```rust -/// use uucore::format::printf; +/// use uucore::format::{printf, FormatArgument}; /// -/// printf("hello %s", &[FormatArgument::String("world")]).unwrap(); +/// printf("hello %s", &[FormatArgument::String("world".into())]).unwrap(); /// // prints "hello world" /// ``` pub fn printf<'a>( @@ -228,10 +228,11 @@ fn printf_writer<'a>( /// # Examples /// /// ```rust -/// use uucore::format::sprintf; +/// use uucore::format::{sprintf, FormatArgument}; /// -/// let s = sprintf("hello %s", &["world".to_string()]).unwrap(); -/// assert_eq!(s, "hello world".to_string()); +/// let s = sprintf("hello %s", &[FormatArgument::String("world".into())]).unwrap(); +/// let s = std::str::from_utf8(&s).unwrap(); +/// assert_eq!(s, "hello world"); /// ``` pub fn sprintf<'a>( format_string: impl AsRef<[u8]>,