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:
parent
f3da0817a5
commit
76eca8d999
1 changed files with 6 additions and 5 deletions
|
@ -194,9 +194,9 @@ fn parse_escape_only(fmt: &[u8]) -> impl Iterator<Item = EscapedChar> + '_ {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```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"
|
/// // prints "hello world"
|
||||||
/// ```
|
/// ```
|
||||||
pub fn printf<'a>(
|
pub fn printf<'a>(
|
||||||
|
@ -228,10 +228,11 @@ fn printf_writer<'a>(
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use uucore::format::sprintf;
|
/// use uucore::format::{sprintf, FormatArgument};
|
||||||
///
|
///
|
||||||
/// let s = sprintf("hello %s", &["world".to_string()]).unwrap();
|
/// let s = sprintf("hello %s", &[FormatArgument::String("world".into())]).unwrap();
|
||||||
/// assert_eq!(s, "hello world".to_string());
|
/// let s = std::str::from_utf8(&s).unwrap();
|
||||||
|
/// assert_eq!(s, "hello world");
|
||||||
/// ```
|
/// ```
|
||||||
pub fn sprintf<'a>(
|
pub fn sprintf<'a>(
|
||||||
format_string: impl AsRef<[u8]>,
|
format_string: impl AsRef<[u8]>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue