lang: update c_str

drop the let binding, easier to use in const context since
CStr::from_bytes_with_nul_unchecked is const since 1.59

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-07-26 12:27:44 +02:00
parent 34d2c91118
commit 4de145aaef

View File

@ -106,8 +106,7 @@ macro_rules! offsetof {
#[macro_export]
macro_rules! c_str {
($data:expr) => {{
let bytes = concat!($data, "\0");
unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(bytes.as_bytes()) }
unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(concat!($data, "\0").as_bytes()) }
}};
}