diff options
author | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2025-03-21 16:33:59 +0000 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-21 13:08:39 -0400 |
commit | 3d972489a827f5d4cb30785eb52bc7fde6b83297 (patch) | |
tree | 4149d95003dd062cf4bf8336d66cb4657f3057dc /src/commands/mod.rs | |
parent | 197437be12b850eae87a1957117e20d605fe1189 (diff) |
fix(key): replace c_str macro with `c""` literal
According to the MSRV in Cargo.toml, we can use this now.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'src/commands/mod.rs')
-rw-r--r-- | src/commands/mod.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 7f466f92..fd15bb38 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -25,28 +25,3 @@ enum Subcommands { #[command(visible_aliases = ["subvol"])] Subvolume(subvolume::Cli), } - -// FIXME: Can be removed after bumping MSRV >= 1.77 in favor of `c""` literals -#[macro_export] -macro_rules! c_str { - ($lit:expr) => { - ::std::ffi::CStr::from_bytes_with_nul(concat!($lit, "\0").as_bytes()) - .unwrap() - .as_ptr() - }; -} - -#[cfg(test)] -mod tests { - use std::ffi::CStr; - - #[test] - fn check_cstr_macro() { - let literal = c_str!("hello"); - - assert_eq!( - literal, - CStr::from_bytes_with_nul(b"hello\0").unwrap().as_ptr() - ); - } -} |