Replace const_cstr!(...) with c"..." CStr literals
Some checks failed
ci / Check (push) Has been cancelled
ci / Test Suite (push) Has been cancelled
ci / Clippy (push) Has been cancelled

Summary: Supported since Rust 1.77: https://blog.rust-lang.org/2024/03/21/Rust-1.77.0.html#c-string-literals

Reviewed By: zertosh

Differential Revision: D59988483

fbshipit-source-id: 756d79612d6d281ce5dbc7973037a5fdb9526f40
This commit is contained in:
David Tolnay 2024-07-19 17:56:11 -07:00 committed by Facebook GitHub Bot
parent c9c1697a0f
commit 852e08e75d
2 changed files with 6 additions and 17 deletions

View file

@ -21,7 +21,6 @@ thiserror = "1.0.49"
tokio = { version = "1.37.0", features = ["full", "test-util", "tracing"] } tokio = { version = "1.37.0", features = ["full", "test-util", "tracing"] }
[dev-dependencies] [dev-dependencies]
const-cstr = "0.3.0"
num_cpus = "1.16" num_cpus = "1.16"
raw-cpuid = "10.6.0" raw-cpuid = "10.6.0"
tempfile = "3.8" tempfile = "3.8"

View file

@ -514,8 +514,6 @@ mod tests {
use std::ffi::CString; use std::ffi::CString;
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
use const_cstr::const_cstr;
use super::*; use super::*;
#[test] #[test]
@ -537,24 +535,16 @@ mod tests {
#[test] #[test]
fn test_is_dir() { fn test_is_dir() {
assert!(is_dir(const_cstr!("/").as_ptr())); assert!(is_dir(c"/".as_ptr()));
assert!(is_dir(const_cstr!("/dev").as_ptr())); assert!(is_dir(c"/dev".as_ptr()));
assert!(!is_dir(const_cstr!("/dev/null").as_ptr())); assert!(!is_dir(c"/dev/null".as_ptr()));
} }
#[test] #[test]
fn test_file_type() { fn test_file_type() {
assert!(FileType::new(const_cstr!("/").as_ptr()).unwrap().is_dir()); assert!(FileType::new(c"/".as_ptr()).unwrap().is_dir());
assert!( assert!(FileType::new(c"/dev".as_ptr()).unwrap().is_dir());
FileType::new(const_cstr!("/dev").as_ptr()) assert!(!FileType::new(c"/dev/null".as_ptr()).unwrap().is_file());
.unwrap()
.is_dir()
);
assert!(
!FileType::new(const_cstr!("/dev/null").as_ptr())
.unwrap()
.is_file()
);
} }
#[test] #[test]