Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: str: add `fmt!` macro

Add the `fmt!` macro, which is a convenience alias for the Rust
`core::format_args!` macro.

For instance, it may be used to create a `CString`:

CString::try_from_fmt(fmt!("{}{}", "abc", 42))?

Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Wedson Almeida Filho and committed by
Miguel Ojeda
ef320549 65e1e497

+6
+6
rust/kernel/str.rs
··· 583 583 unsafe { CStr::from_bytes_with_nul_unchecked(self.buf.as_slice()) } 584 584 } 585 585 } 586 + 587 + /// A convenience alias for [`core::format_args`]. 588 + #[macro_export] 589 + macro_rules! fmt { 590 + ($($f:tt)*) => ( core::format_args!($($f)*) ) 591 + }