Debian Codegraph @

third_party/rust/cstr/tests/clippy_lints.rs

raw
1 use cstr::cstr;
2 use std::ffi::CStr;
3
4 #[test]
5 #[deny(clippy::transmute_ptr_to_ref)]
6 fn deny_transmute_ptr_to_ref() {
7 let s: &'static CStr = cstr!("foo\u{4e00}bar");
8 let expected = b"foo\xe4\xb8\x80bar\0";
9 assert_eq!(s, CStr::from_bytes_with_nul(expected).unwrap());
10 }