From 43ab50db424274ee6aa99a2a45dc2956a2f2e434 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 6 Mar 2022 01:22:59 +0000 Subject: [PATCH] use TC_UUID_STRING_BYTES constant directly --- Cargo.lock | 1 - lib/Cargo.toml | 1 - lib/src/uuid.rs | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f5d620c1..b4ff54c2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3039,7 +3039,6 @@ dependencies = [ "libc", "pretty_assertions", "taskchampion", - "uuid", ] [[package]] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6f85b62b7..6d6158026 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,7 +11,6 @@ crate-type = ["staticlib", "cdylib"] libc = "0.2.113" chrono = "^0.4.10" taskchampion = { path = "../taskchampion" } -uuid = { version = "^0.8.2", features = ["v4"] } anyhow = "1.0" [dev-dependencies] diff --git a/lib/src/uuid.rs b/lib/src/uuid.rs index c4ec8f474..28421a81c 100644 --- a/lib/src/uuid.rs +++ b/lib/src/uuid.rs @@ -87,9 +87,8 @@ pub unsafe extern "C" fn tc_uuid_to_buf(tcuuid: TCUuid, buf: *mut libc::c_char) // - content of buf will not be mutated during the lifetime of this slice (lifetime // does not outlive this function call) // - the length of the buffer is less than isize::MAX (promised by caller) - let buf: &mut [u8] = unsafe { - std::slice::from_raw_parts_mut(buf as *mut u8, ::uuid::adapter::Hyphenated::LENGTH) - }; + let buf: &mut [u8] = + unsafe { std::slice::from_raw_parts_mut(buf as *mut u8, TC_UUID_STRING_BYTES) }; // SAFETY: // - tcuuid is a valid TCUuid (all byte patterns are valid) let uuid: Uuid = unsafe { TCUuid::val_from_arg(tcuuid) };