summaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2018-10-17 00:16:21 +0000
committercypherpunks <cypherpunks@torproject.org>2018-10-17 00:16:21 +0000
commit2f0744b3e6f579f25db1ed6e048d0418ac2ab570 (patch)
treeb722ef373da7828d2c50c9dd2c22eaed27cbd859 /src/rust
parente97adaf8dc13a4f500fab3d70c9c31400a01954f (diff)
downloadtor-2f0744b3e6f579f25db1ed6e048d0418ac2ab570.tar.gz
tor-2f0744b3e6f579f25db1ed6e048d0418ac2ab570.zip
rust/tor_util: drop unsafe block in cstr!
This is unnecessary just to get an empty string, there's Default::default(). Fix on 8fff331bb095dc6f5e2fe2ecfc9ab08ea9e2fe97.
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/tor_util/strings.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/rust/tor_util/strings.rs b/src/rust/tor_util/strings.rs
index d64275e06b..71a908a58c 100644
--- a/src/rust/tor_util/strings.rs
+++ b/src/rust/tor_util/strings.rs
@@ -105,11 +105,7 @@ macro_rules! cstr {
($($bytes:expr),*) => (
::std::ffi::CStr::from_bytes_with_nul(
concat!($($bytes),*, "\0").as_bytes()
- ).unwrap_or(
- unsafe{
- ::std::ffi::CStr::from_bytes_with_nul_unchecked(b"\0")
- }
- )
+ ).unwrap_or_default()
)
}