1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

uucore/format: fix doctests

This commit is contained in:
Terts Diepraam 2023-11-17 14:43:25 +01:00
parent f3da0817a5
commit 76eca8d999

View file

@ -194,9 +194,9 @@ fn parse_escape_only(fmt: &[u8]) -> impl Iterator<Item = EscapedChar> + '_ {
/// # 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]>,